replicas-cli 0.3.639 → 0.3.641
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +418 -261
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -214,6 +214,9 @@ function getWorkspaceDashboardUrl(workspaceId, options = {}) {
|
|
|
214
214
|
const query = params.length > 0 ? `?${params.join("&")}` : "";
|
|
215
215
|
return `${webAppUrl2}${WEB_APP_PATHS.fullscreenWorkspaces}/${workspaceIdValue}${query}`;
|
|
216
216
|
}
|
|
217
|
+
function getArtifactUrl(artifactId, webAppUrl2 = DEFAULT_WEB_APP_URL) {
|
|
218
|
+
return `${webAppUrl2}${WEB_APP_PATHS.artifacts}/${encodeURIComponent(artifactId)}`;
|
|
219
|
+
}
|
|
217
220
|
function getOrganizationMediaPath(organizationId, mediaId) {
|
|
218
221
|
return `/organizations/${encodeURIComponent(organizationId)}/media/${encodeURIComponent(mediaId)}`;
|
|
219
222
|
}
|
|
@@ -235,6 +238,7 @@ var init_urls = __esm({
|
|
|
235
238
|
workspaces: "/workspace",
|
|
236
239
|
environmentSetup: "/workspace/setup",
|
|
237
240
|
automations: "/automations",
|
|
241
|
+
artifacts: "/artifacts",
|
|
238
242
|
environment: "/environment",
|
|
239
243
|
analytics: "/analytics",
|
|
240
244
|
review: "/review",
|
|
@@ -270,7 +274,7 @@ var init_urls = __esm({
|
|
|
270
274
|
WEB_APP_PATHS.automations,
|
|
271
275
|
`${WEB_APP_PATHS.automations}/${UUID_PATTERN}`
|
|
272
276
|
];
|
|
273
|
-
APP_LINK_PATTERNS = APP_LINK_PATHS.map((
|
|
277
|
+
APP_LINK_PATTERNS = APP_LINK_PATHS.map((path14) => new RegExp(`^${path14.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\?/g, ".").replace(/\*/g, ".*")}$`));
|
|
274
278
|
LEGACY_WEB_APP_PATHS = {
|
|
275
279
|
app: "/app",
|
|
276
280
|
home: "/home",
|
|
@@ -664,10 +668,10 @@ function mergeDefs(...defs) {
|
|
|
664
668
|
function cloneDef(schema) {
|
|
665
669
|
return mergeDefs(schema._zod.def);
|
|
666
670
|
}
|
|
667
|
-
function getElementAtPath(obj,
|
|
668
|
-
if (!
|
|
671
|
+
function getElementAtPath(obj, path14) {
|
|
672
|
+
if (!path14)
|
|
669
673
|
return obj;
|
|
670
|
-
return
|
|
674
|
+
return path14.reduce((acc, key2) => acc?.[key2], obj);
|
|
671
675
|
}
|
|
672
676
|
function promiseAllObject(promisesObj) {
|
|
673
677
|
const keys = Object.keys(promisesObj);
|
|
@@ -926,11 +930,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
926
930
|
}
|
|
927
931
|
return false;
|
|
928
932
|
}
|
|
929
|
-
function prefixIssues(
|
|
933
|
+
function prefixIssues(path14, issues) {
|
|
930
934
|
return issues.map((iss) => {
|
|
931
935
|
var _a3;
|
|
932
936
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
933
|
-
iss.path.unshift(
|
|
937
|
+
iss.path.unshift(path14);
|
|
934
938
|
return iss;
|
|
935
939
|
});
|
|
936
940
|
}
|
|
@@ -1465,16 +1469,16 @@ function flattenError(error62, mapper = (issue3) => issue3.message) {
|
|
|
1465
1469
|
}
|
|
1466
1470
|
function formatError(error62, mapper = (issue3) => issue3.message) {
|
|
1467
1471
|
const fieldErrors = { _errors: [] };
|
|
1468
|
-
const processError = (error63,
|
|
1472
|
+
const processError = (error63, path14 = []) => {
|
|
1469
1473
|
for (const issue3 of error63.issues) {
|
|
1470
1474
|
if (issue3.code === "invalid_union" && issue3.errors.length) {
|
|
1471
|
-
issue3.errors.map((issues) => processError({ issues }, [...
|
|
1475
|
+
issue3.errors.map((issues) => processError({ issues }, [...path14, ...issue3.path]));
|
|
1472
1476
|
} else if (issue3.code === "invalid_key") {
|
|
1473
|
-
processError({ issues: issue3.issues }, [...
|
|
1477
|
+
processError({ issues: issue3.issues }, [...path14, ...issue3.path]);
|
|
1474
1478
|
} else if (issue3.code === "invalid_element") {
|
|
1475
|
-
processError({ issues: issue3.issues }, [...
|
|
1479
|
+
processError({ issues: issue3.issues }, [...path14, ...issue3.path]);
|
|
1476
1480
|
} else {
|
|
1477
|
-
const fullpath = [...
|
|
1481
|
+
const fullpath = [...path14, ...issue3.path];
|
|
1478
1482
|
if (fullpath.length === 0) {
|
|
1479
1483
|
fieldErrors._errors.push(mapper(issue3));
|
|
1480
1484
|
} else {
|
|
@@ -1513,17 +1517,17 @@ function formatError(error62, mapper = (issue3) => issue3.message) {
|
|
|
1513
1517
|
}
|
|
1514
1518
|
function treeifyError(error62, mapper = (issue3) => issue3.message) {
|
|
1515
1519
|
const result = { errors: [] };
|
|
1516
|
-
const processError = (error63,
|
|
1520
|
+
const processError = (error63, path14 = []) => {
|
|
1517
1521
|
var _a3;
|
|
1518
1522
|
for (const issue3 of error63.issues) {
|
|
1519
1523
|
if (issue3.code === "invalid_union" && issue3.errors.length) {
|
|
1520
|
-
issue3.errors.map((issues) => processError({ issues }, [...
|
|
1524
|
+
issue3.errors.map((issues) => processError({ issues }, [...path14, ...issue3.path]));
|
|
1521
1525
|
} else if (issue3.code === "invalid_key") {
|
|
1522
|
-
processError({ issues: issue3.issues }, [...
|
|
1526
|
+
processError({ issues: issue3.issues }, [...path14, ...issue3.path]);
|
|
1523
1527
|
} else if (issue3.code === "invalid_element") {
|
|
1524
|
-
processError({ issues: issue3.issues }, [...
|
|
1528
|
+
processError({ issues: issue3.issues }, [...path14, ...issue3.path]);
|
|
1525
1529
|
} else {
|
|
1526
|
-
const fullpath = [...
|
|
1530
|
+
const fullpath = [...path14, ...issue3.path];
|
|
1527
1531
|
if (fullpath.length === 0) {
|
|
1528
1532
|
result.errors.push(mapper(issue3));
|
|
1529
1533
|
continue;
|
|
@@ -1562,8 +1566,8 @@ function treeifyError(error62, mapper = (issue3) => issue3.message) {
|
|
|
1562
1566
|
}
|
|
1563
1567
|
function toDotPath(_path) {
|
|
1564
1568
|
const segs = [];
|
|
1565
|
-
const
|
|
1566
|
-
for (const seg of
|
|
1569
|
+
const path14 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
1570
|
+
for (const seg of path14) {
|
|
1567
1571
|
if (typeof seg === "number")
|
|
1568
1572
|
segs.push(`[${seg}]`);
|
|
1569
1573
|
else if (typeof seg === "symbol")
|
|
@@ -19681,13 +19685,13 @@ function resolveRef(ref, ctx) {
|
|
|
19681
19685
|
if (!ref.startsWith("#")) {
|
|
19682
19686
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
19683
19687
|
}
|
|
19684
|
-
const
|
|
19685
|
-
if (
|
|
19688
|
+
const path14 = ref.slice(1).split("/").filter(Boolean);
|
|
19689
|
+
if (path14.length === 0) {
|
|
19686
19690
|
return ctx.rootSchema;
|
|
19687
19691
|
}
|
|
19688
19692
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
19689
|
-
if (
|
|
19690
|
-
const key2 =
|
|
19693
|
+
if (path14[0] === defsKey) {
|
|
19694
|
+
const key2 = path14[1] === void 0 ? void 0 : decodeJSONPointerSegment(path14[1]);
|
|
19691
19695
|
if (!key2 || !ctx.defs[key2]) {
|
|
19692
19696
|
throw new Error(`Reference not found: ${ref}`);
|
|
19693
19697
|
}
|
|
@@ -21355,6 +21359,15 @@ var init_trigger_schemas = __esm({
|
|
|
21355
21359
|
});
|
|
21356
21360
|
|
|
21357
21361
|
// ../shared/src/format.ts
|
|
21362
|
+
function formatBytes(n, opts = {}) {
|
|
21363
|
+
const { baseUnit = "B", mbDigits = 1, gbDigits } = opts;
|
|
21364
|
+
if (n < 1024) return `${n} ${baseUnit}`;
|
|
21365
|
+
if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`;
|
|
21366
|
+
if (gbDigits === void 0 || n < 1024 * 1024 * 1024) {
|
|
21367
|
+
return `${(n / (1024 * 1024)).toFixed(mbDigits)} MB`;
|
|
21368
|
+
}
|
|
21369
|
+
return `${(n / (1024 * 1024 * 1024)).toFixed(gbDigits)} GB`;
|
|
21370
|
+
}
|
|
21358
21371
|
function relativeParts(input2, now = Date.now()) {
|
|
21359
21372
|
const then = new Date(input2).getTime();
|
|
21360
21373
|
if (Number.isNaN(then)) return null;
|
|
@@ -21646,7 +21659,7 @@ var init_repository_path = __esm({
|
|
|
21646
21659
|
"use strict";
|
|
21647
21660
|
init_zod();
|
|
21648
21661
|
repositoryPathSchema = external_exports.string().trim().min(1).max(1e3).refine(
|
|
21649
|
-
(
|
|
21662
|
+
(path14) => !path14.startsWith("/") && path14.split("/").every((part) => part !== "" && part !== "." && part !== ".."),
|
|
21650
21663
|
"path is relative to the repository root, with no empty, . or .. parts"
|
|
21651
21664
|
);
|
|
21652
21665
|
}
|
|
@@ -21985,7 +21998,7 @@ function jsonStrings(raw) {
|
|
|
21985
21998
|
} catch {
|
|
21986
21999
|
return null;
|
|
21987
22000
|
}
|
|
21988
|
-
const strings = [],
|
|
22001
|
+
const strings = [], path14 = [], inObject = [];
|
|
21989
22002
|
let expectKey = false;
|
|
21990
22003
|
for (let index = 0; index < raw.length; index++) {
|
|
21991
22004
|
const char = raw[index];
|
|
@@ -21993,22 +22006,22 @@ function jsonStrings(raw) {
|
|
|
21993
22006
|
let end = index + 1;
|
|
21994
22007
|
while (raw[end] !== '"') end += raw[end] === "\\" ? 2 : 1;
|
|
21995
22008
|
const key2 = inObject.at(-1) === true && expectKey;
|
|
21996
|
-
if (key2)
|
|
21997
|
-
strings.push({ start: index, end: end + 1, path: key2 ?
|
|
22009
|
+
if (key2) path14[path14.length - 1] = parseJsonString(raw.slice(index, end + 1));
|
|
22010
|
+
strings.push({ start: index, end: end + 1, path: key2 ? path14.slice(0, -1) : [...path14], key: key2 });
|
|
21998
22011
|
expectKey = false;
|
|
21999
22012
|
index = end;
|
|
22000
22013
|
} else if (char === "{" || char === "[") {
|
|
22001
22014
|
inObject.push(char === "{");
|
|
22002
|
-
|
|
22015
|
+
path14.push(char === "{" ? "" : 0);
|
|
22003
22016
|
expectKey = char === "{";
|
|
22004
22017
|
} else if (char === "}" || char === "]") {
|
|
22005
22018
|
inObject.pop();
|
|
22006
|
-
|
|
22019
|
+
path14.pop();
|
|
22007
22020
|
} else if (char === ",") {
|
|
22008
22021
|
if (inObject.at(-1)) expectKey = true;
|
|
22009
22022
|
else {
|
|
22010
|
-
const last =
|
|
22011
|
-
if (typeof last === "number")
|
|
22023
|
+
const last = path14[path14.length - 1];
|
|
22024
|
+
if (typeof last === "number") path14[path14.length - 1] = last + 1;
|
|
22012
22025
|
}
|
|
22013
22026
|
}
|
|
22014
22027
|
}
|
|
@@ -22152,8 +22165,8 @@ function proofValues(content, known, allowCommitted) {
|
|
|
22152
22165
|
else high = middle - 1;
|
|
22153
22166
|
}
|
|
22154
22167
|
if (strings && (!string4 || start >= string4.end)) return { label: "the JSON outside any string", kept: false };
|
|
22155
|
-
const
|
|
22156
|
-
if (string4?.key) return { label: `a JSON key${
|
|
22168
|
+
const path14 = string4 ? fieldPath(string4.path, known) : "";
|
|
22169
|
+
if (string4?.key) return { label: `a JSON key${path14 ? ` in ${path14}` : ""}`, kept: false };
|
|
22157
22170
|
let body2, from = start, to = end;
|
|
22158
22171
|
if (string4) {
|
|
22159
22172
|
let own2 = read.get(string4.start);
|
|
@@ -22161,7 +22174,7 @@ function proofValues(content, known, allowCommitted) {
|
|
|
22161
22174
|
body2 = own2;
|
|
22162
22175
|
[from, to] = [own2.at[start - string4.start], own2.at[Math.min(end, string4.end - 1) - string4.start]];
|
|
22163
22176
|
} else body2 = whole ?? (whole = readText(content, null));
|
|
22164
|
-
const field2 =
|
|
22177
|
+
const field2 = path14 || "content", line = lineAt(body2.lineStarts, from);
|
|
22165
22178
|
if (!body2.diff) return { label: body2.text.includes("\n") ? `${field2}, line ${line + 1}` : field2, kept: false };
|
|
22166
22179
|
const kind = body2.diff.kinds[line], file2 = body2.diff.files[line];
|
|
22167
22180
|
const where = file2 === null ? "" : containsProofSecret(file2, known) ? ", in a file whose path holds the value" : `, in ${file2}`;
|
|
@@ -22418,7 +22431,7 @@ var init_secrets = __esm({
|
|
|
22418
22431
|
[STANDALONE_TOKEN, "a token"]
|
|
22419
22432
|
]);
|
|
22420
22433
|
POSITIONAL = /* @__PURE__ */ new Set([...BY_NAME, ...SECRET_PATTERNS.slice(1, 5)]);
|
|
22421
|
-
fieldPath = (
|
|
22434
|
+
fieldPath = (path14, known) => path14.map((part) => typeof part === "number" ? `[${part}]` : containsProofSecret(part, known) ? ".<key>" : `.${part}`).join("").replace(/^\./, "");
|
|
22422
22435
|
DIFF = /^(?:diff --git |--- \S|\+\+\+ \S|@@ -\d)/m;
|
|
22423
22436
|
HUNK = /^@@ -\d+(?:,(\d+))? \+\d+(?:,(\d+))? @@/;
|
|
22424
22437
|
SIDES = [/* @__PURE__ */ new Set(["removed", "context"]), /* @__PURE__ */ new Set(["added", "context"])];
|
|
@@ -23557,7 +23570,7 @@ var init_security = __esm({
|
|
|
23557
23570
|
FIRST_VALUE_PLACEHOLDER = "{first.value}";
|
|
23558
23571
|
declaredReplayRequestSchema = (placeholders) => external_exports.strictObject({
|
|
23559
23572
|
method: external_exports.enum(["GET", "POST", "PUT", "PATCH", "DELETE"]),
|
|
23560
|
-
path: external_exports.string().startsWith("/", 'path must start with "/"').max(2e3).refine((
|
|
23573
|
+
path: external_exports.string().startsWith("/", 'path must start with "/"').max(2e3).refine((path14) => !/[{}]/.test(placeholders.reduce((rest, placeholder) => rest.replaceAll(placeholder, ""), path14)), `the only placeholders in path are ${placeholders.join(" and ")}`),
|
|
23561
23574
|
body: external_exports.json().optional()
|
|
23562
23575
|
});
|
|
23563
23576
|
usesFirstValue = (request2) => `${request2.path}${JSON.stringify(request2.body ?? null)}`.includes(FIRST_VALUE_PLACEHOLDER);
|
|
@@ -26708,8 +26721,8 @@ function parseIssueContractRecord(schema, value, at, report) {
|
|
|
26708
26721
|
return result.data;
|
|
26709
26722
|
}
|
|
26710
26723
|
for (const issue3 of result.error.issues) {
|
|
26711
|
-
const
|
|
26712
|
-
report.problems.add(`${
|
|
26724
|
+
const path14 = [at, ...issue3.path.map((key2) => typeof key2 === "number" || UUID_RE.test(String(key2)) ? "*" : String(key2))].filter(Boolean).join(".");
|
|
26725
|
+
report.problems.add(`${path14} ${issue3.code}${issue3.code === "invalid_value" ? ` ${String(issue3.input).slice(0, 40)}` : ""}`);
|
|
26713
26726
|
}
|
|
26714
26727
|
report.dropped++;
|
|
26715
26728
|
return void 0;
|
|
@@ -27028,10 +27041,12 @@ var init_issues = __esm({
|
|
|
27028
27041
|
kind: external_exports.enum(WORKSPACE_KINDS),
|
|
27029
27042
|
status: external_exports.enum(WORKSPACE_STATUSES),
|
|
27030
27043
|
avatar: managerAvatarSchema.nullable(),
|
|
27031
|
-
manager_id: external_exports.string().nullable()
|
|
27044
|
+
manager_id: external_exports.string().nullable(),
|
|
27045
|
+
user_id: external_exports.string().nullable().default(null)
|
|
27032
27046
|
});
|
|
27033
27047
|
issuesBootstrapResponseSchema = external_exports.object({
|
|
27034
27048
|
sync_id: external_exports.number().int(),
|
|
27049
|
+
directory_version: external_exports.number().int().default(0),
|
|
27035
27050
|
issue_key: external_exports.string(),
|
|
27036
27051
|
users: external_exports.array(issueDirectoryUserSchema),
|
|
27037
27052
|
workspaces: external_exports.array(issueDirectoryWorkspaceSchema),
|
|
@@ -29129,8 +29144,8 @@ var init_preferences = __esm({
|
|
|
29129
29144
|
});
|
|
29130
29145
|
|
|
29131
29146
|
// ../shared/src/environment-files.ts
|
|
29132
|
-
function validateEnvironmentFilePath(
|
|
29133
|
-
const trimmedPath =
|
|
29147
|
+
function validateEnvironmentFilePath(path14) {
|
|
29148
|
+
const trimmedPath = path14.trim();
|
|
29134
29149
|
if (!trimmedPath) {
|
|
29135
29150
|
return "Path is required.";
|
|
29136
29151
|
}
|
|
@@ -29563,7 +29578,7 @@ var init_environment_config = __esm({
|
|
|
29563
29578
|
}).nullable().optional(),
|
|
29564
29579
|
repositories: external_exports.array(external_exports.string().trim().min(1)).optional(),
|
|
29565
29580
|
workspaceSize: external_exports.enum(WORKSPACE_SIZE_OPTIONS).optional(),
|
|
29566
|
-
files: external_exports.record(external_exports.string().trim().refine((
|
|
29581
|
+
files: external_exports.record(external_exports.string().trim().refine((path14) => !validateEnvironmentFilePath(path14), "must be a file path starting with ~/"), external_exports.strictObject({
|
|
29567
29582
|
name: external_exports.string().trim().min(1).optional(),
|
|
29568
29583
|
content: external_exports.string().max(65536)
|
|
29569
29584
|
})).optional(),
|
|
@@ -30374,11 +30389,11 @@ function parseShellScript(script, cwd) {
|
|
|
30374
30389
|
parseUntil(scope, 0, false);
|
|
30375
30390
|
return scope.commands;
|
|
30376
30391
|
}
|
|
30377
|
-
function resolveShellPath(dir,
|
|
30378
|
-
if (
|
|
30379
|
-
if (!
|
|
30392
|
+
function resolveShellPath(dir, path14) {
|
|
30393
|
+
if (path14.includes(SHELL_OPAQUE)) return null;
|
|
30394
|
+
if (!path14.startsWith("/") && dir === null) return null;
|
|
30380
30395
|
const parts = [];
|
|
30381
|
-
for (const part of (
|
|
30396
|
+
for (const part of (path14.startsWith("/") ? path14 : `${dir}/${path14}`).split("/")) {
|
|
30382
30397
|
if (part === "..") parts.pop();
|
|
30383
30398
|
else if (part && part !== ".") parts.push(part);
|
|
30384
30399
|
}
|
|
@@ -30839,8 +30854,8 @@ function parseSkillName(tool, input2) {
|
|
|
30839
30854
|
const skillName = parsedInput.skill ?? parsedInput.name;
|
|
30840
30855
|
return typeof skillName === "string" && skillName ? skillName : null;
|
|
30841
30856
|
}
|
|
30842
|
-
function skillNameFromFilePath(
|
|
30843
|
-
const parts =
|
|
30857
|
+
function skillNameFromFilePath(path14) {
|
|
30858
|
+
const parts = path14.split(/[\\/]+/).filter(Boolean);
|
|
30844
30859
|
if (parts.length < 2 || parts[parts.length - 1].toLowerCase() !== "skill.md") return null;
|
|
30845
30860
|
const skillName = parts[parts.length - 2];
|
|
30846
30861
|
return /[*?[\]{}…$]/.test(skillName) || ["skills", ".system"].includes(skillName.toLowerCase()) ? null : skillName;
|
|
@@ -30849,19 +30864,19 @@ function skillFilePath(tool, input2) {
|
|
|
30849
30864
|
if (!READ_TOOL_NAMES.has(tool.toLowerCase())) return null;
|
|
30850
30865
|
const parsedInput = typeof input2 === "string" ? safeJsonParse(input2, null) : input2;
|
|
30851
30866
|
if (!isRecord(parsedInput)) return null;
|
|
30852
|
-
const
|
|
30853
|
-
return
|
|
30867
|
+
const path14 = [parsedInput.path, parsedInput.filePath, parsedInput.file_path].find((value) => typeof value === "string" && value.length > 0);
|
|
30868
|
+
return path14 && skillNameFromFilePath(path14) ? path14 : null;
|
|
30854
30869
|
}
|
|
30855
30870
|
function createCallDisplayMessage(message2) {
|
|
30856
30871
|
if (message2.inputRequest) return { ...message2, type: "tool_call" };
|
|
30857
|
-
const
|
|
30858
|
-
const skillName = message2.server.toLowerCase() === "skills" ? message2.tool :
|
|
30872
|
+
const path14 = skillFilePath(message2.tool, message2.input);
|
|
30873
|
+
const skillName = message2.server.toLowerCase() === "skills" ? message2.tool : path14 ? skillNameFromFilePath(path14) : parseSkillName(message2.tool, message2.input);
|
|
30859
30874
|
if (skillName === null) return { ...message2, type: "tool_call" };
|
|
30860
30875
|
return {
|
|
30861
30876
|
id: message2.id,
|
|
30862
30877
|
type: "skill",
|
|
30863
30878
|
skillName,
|
|
30864
|
-
...
|
|
30879
|
+
...path14 ? { path: path14 } : {},
|
|
30865
30880
|
status: message2.status,
|
|
30866
30881
|
timestamp: message2.timestamp
|
|
30867
30882
|
};
|
|
@@ -30893,11 +30908,11 @@ function userMessageText(message2) {
|
|
|
30893
30908
|
|
|
30894
30909
|
${message2.content}` : message2.content;
|
|
30895
30910
|
}
|
|
30896
|
-
function fileContentDiff(
|
|
30911
|
+
function fileContentDiff(path14, content, action) {
|
|
30897
30912
|
const lines = content.replace(/\n$/, "").split("\n");
|
|
30898
30913
|
return [
|
|
30899
|
-
`--- ${action === "add" ? "/dev/null" : `a/${
|
|
30900
|
-
`+++ ${action === "add" ? `b/${
|
|
30914
|
+
`--- ${action === "add" ? "/dev/null" : `a/${path14}`}`,
|
|
30915
|
+
`+++ ${action === "add" ? `b/${path14}` : "/dev/null"}`,
|
|
30901
30916
|
action === "add" ? `@@ -0,0 +1,${lines.length} @@` : `@@ -1,${lines.length} +0,0 @@`,
|
|
30902
30917
|
...lines.map((line) => `${action === "add" ? "+" : "-"}${line}`)
|
|
30903
30918
|
].join("\n");
|
|
@@ -30912,8 +30927,8 @@ function skillNamesFromCommand(command) {
|
|
|
30912
30927
|
if (!SKILL_READ_COMMANDS.has(name) || writesFiles(name, argv) || fileWrites(shellCommand).length > 0) return [];
|
|
30913
30928
|
const paths = readCommandPaths(name, argv);
|
|
30914
30929
|
const stdinTarget = shellCommand.stdinTarget?.replaceAll(SHELL_OPAQUE, "\u2026");
|
|
30915
|
-
return (paths.length === 0 && stdinTarget ? [stdinTarget] : paths).flatMap((
|
|
30916
|
-
const resolved =
|
|
30930
|
+
return (paths.length === 0 && stdinTarget ? [stdinTarget] : paths).flatMap((path14) => {
|
|
30931
|
+
const resolved = path14.startsWith("~") ? path14 : resolveShellPath(shellCommand.dir, path14)?.replace(SCRIPT_ROOT, "");
|
|
30917
30932
|
const skillName = resolved && skillNameFromFilePath(resolved);
|
|
30918
30933
|
return skillName ? [skillName] : [];
|
|
30919
30934
|
});
|
|
@@ -30997,7 +31012,7 @@ var init_format2 = __esm({
|
|
|
30997
31012
|
PATTERN_FLAGS = /* @__PURE__ */ new Set(["-e", "-f", "--file", "--regexp"]);
|
|
30998
31013
|
SCRIPT_ROOT = "/";
|
|
30999
31014
|
commandName = (argv) => argv[0].split("/").pop() ?? argv[0];
|
|
31000
|
-
fileWrites = ({ writes }) => writes.filter(({ path:
|
|
31015
|
+
fileWrites = ({ writes }) => writes.filter(({ path: path14 }) => path14 !== "/dev/null");
|
|
31001
31016
|
SKILL_READ_COMMANDS = /* @__PURE__ */ new Set(["awk", "bat", "cat", "head", "less", "more", "nl", "sed", "tail"]);
|
|
31002
31017
|
}
|
|
31003
31018
|
});
|
|
@@ -31112,17 +31127,17 @@ var require_visit = __commonJS({
|
|
|
31112
31127
|
visit2.BREAK = BREAK;
|
|
31113
31128
|
visit2.SKIP = SKIP;
|
|
31114
31129
|
visit2.REMOVE = REMOVE;
|
|
31115
|
-
function visit_(key2, node2, visitor,
|
|
31116
|
-
const ctrl = callVisitor(key2, node2, visitor,
|
|
31130
|
+
function visit_(key2, node2, visitor, path14) {
|
|
31131
|
+
const ctrl = callVisitor(key2, node2, visitor, path14);
|
|
31117
31132
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
31118
|
-
replaceNode(key2,
|
|
31119
|
-
return visit_(key2, ctrl, visitor,
|
|
31133
|
+
replaceNode(key2, path14, ctrl);
|
|
31134
|
+
return visit_(key2, ctrl, visitor, path14);
|
|
31120
31135
|
}
|
|
31121
31136
|
if (typeof ctrl !== "symbol") {
|
|
31122
31137
|
if (identity.isCollection(node2)) {
|
|
31123
|
-
|
|
31138
|
+
path14 = Object.freeze(path14.concat(node2));
|
|
31124
31139
|
for (let i = 0; i < node2.items.length; ++i) {
|
|
31125
|
-
const ci = visit_(i, node2.items[i], visitor,
|
|
31140
|
+
const ci = visit_(i, node2.items[i], visitor, path14);
|
|
31126
31141
|
if (typeof ci === "number")
|
|
31127
31142
|
i = ci - 1;
|
|
31128
31143
|
else if (ci === BREAK)
|
|
@@ -31133,13 +31148,13 @@ var require_visit = __commonJS({
|
|
|
31133
31148
|
}
|
|
31134
31149
|
}
|
|
31135
31150
|
} else if (identity.isPair(node2)) {
|
|
31136
|
-
|
|
31137
|
-
const ck = visit_("key", node2.key, visitor,
|
|
31151
|
+
path14 = Object.freeze(path14.concat(node2));
|
|
31152
|
+
const ck = visit_("key", node2.key, visitor, path14);
|
|
31138
31153
|
if (ck === BREAK)
|
|
31139
31154
|
return BREAK;
|
|
31140
31155
|
else if (ck === REMOVE)
|
|
31141
31156
|
node2.key = null;
|
|
31142
|
-
const cv = visit_("value", node2.value, visitor,
|
|
31157
|
+
const cv = visit_("value", node2.value, visitor, path14);
|
|
31143
31158
|
if (cv === BREAK)
|
|
31144
31159
|
return BREAK;
|
|
31145
31160
|
else if (cv === REMOVE)
|
|
@@ -31160,17 +31175,17 @@ var require_visit = __commonJS({
|
|
|
31160
31175
|
visitAsync.BREAK = BREAK;
|
|
31161
31176
|
visitAsync.SKIP = SKIP;
|
|
31162
31177
|
visitAsync.REMOVE = REMOVE;
|
|
31163
|
-
async function visitAsync_(key2, node2, visitor,
|
|
31164
|
-
const ctrl = await callVisitor(key2, node2, visitor,
|
|
31178
|
+
async function visitAsync_(key2, node2, visitor, path14) {
|
|
31179
|
+
const ctrl = await callVisitor(key2, node2, visitor, path14);
|
|
31165
31180
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
31166
|
-
replaceNode(key2,
|
|
31167
|
-
return visitAsync_(key2, ctrl, visitor,
|
|
31181
|
+
replaceNode(key2, path14, ctrl);
|
|
31182
|
+
return visitAsync_(key2, ctrl, visitor, path14);
|
|
31168
31183
|
}
|
|
31169
31184
|
if (typeof ctrl !== "symbol") {
|
|
31170
31185
|
if (identity.isCollection(node2)) {
|
|
31171
|
-
|
|
31186
|
+
path14 = Object.freeze(path14.concat(node2));
|
|
31172
31187
|
for (let i = 0; i < node2.items.length; ++i) {
|
|
31173
|
-
const ci = await visitAsync_(i, node2.items[i], visitor,
|
|
31188
|
+
const ci = await visitAsync_(i, node2.items[i], visitor, path14);
|
|
31174
31189
|
if (typeof ci === "number")
|
|
31175
31190
|
i = ci - 1;
|
|
31176
31191
|
else if (ci === BREAK)
|
|
@@ -31181,13 +31196,13 @@ var require_visit = __commonJS({
|
|
|
31181
31196
|
}
|
|
31182
31197
|
}
|
|
31183
31198
|
} else if (identity.isPair(node2)) {
|
|
31184
|
-
|
|
31185
|
-
const ck = await visitAsync_("key", node2.key, visitor,
|
|
31199
|
+
path14 = Object.freeze(path14.concat(node2));
|
|
31200
|
+
const ck = await visitAsync_("key", node2.key, visitor, path14);
|
|
31186
31201
|
if (ck === BREAK)
|
|
31187
31202
|
return BREAK;
|
|
31188
31203
|
else if (ck === REMOVE)
|
|
31189
31204
|
node2.key = null;
|
|
31190
|
-
const cv = await visitAsync_("value", node2.value, visitor,
|
|
31205
|
+
const cv = await visitAsync_("value", node2.value, visitor, path14);
|
|
31191
31206
|
if (cv === BREAK)
|
|
31192
31207
|
return BREAK;
|
|
31193
31208
|
else if (cv === REMOVE)
|
|
@@ -31214,23 +31229,23 @@ var require_visit = __commonJS({
|
|
|
31214
31229
|
}
|
|
31215
31230
|
return visitor;
|
|
31216
31231
|
}
|
|
31217
|
-
function callVisitor(key2, node2, visitor,
|
|
31232
|
+
function callVisitor(key2, node2, visitor, path14) {
|
|
31218
31233
|
if (typeof visitor === "function")
|
|
31219
|
-
return visitor(key2, node2,
|
|
31234
|
+
return visitor(key2, node2, path14);
|
|
31220
31235
|
if (identity.isMap(node2))
|
|
31221
|
-
return visitor.Map?.(key2, node2,
|
|
31236
|
+
return visitor.Map?.(key2, node2, path14);
|
|
31222
31237
|
if (identity.isSeq(node2))
|
|
31223
|
-
return visitor.Seq?.(key2, node2,
|
|
31238
|
+
return visitor.Seq?.(key2, node2, path14);
|
|
31224
31239
|
if (identity.isPair(node2))
|
|
31225
|
-
return visitor.Pair?.(key2, node2,
|
|
31240
|
+
return visitor.Pair?.(key2, node2, path14);
|
|
31226
31241
|
if (identity.isScalar(node2))
|
|
31227
|
-
return visitor.Scalar?.(key2, node2,
|
|
31242
|
+
return visitor.Scalar?.(key2, node2, path14);
|
|
31228
31243
|
if (identity.isAlias(node2))
|
|
31229
|
-
return visitor.Alias?.(key2, node2,
|
|
31244
|
+
return visitor.Alias?.(key2, node2, path14);
|
|
31230
31245
|
return void 0;
|
|
31231
31246
|
}
|
|
31232
|
-
function replaceNode(key2,
|
|
31233
|
-
const parent =
|
|
31247
|
+
function replaceNode(key2, path14, node2) {
|
|
31248
|
+
const parent = path14[path14.length - 1];
|
|
31234
31249
|
if (identity.isCollection(parent)) {
|
|
31235
31250
|
parent.items[key2] = node2;
|
|
31236
31251
|
} else if (identity.isPair(parent)) {
|
|
@@ -31840,10 +31855,10 @@ var require_Collection = __commonJS({
|
|
|
31840
31855
|
var createNode = require_createNode();
|
|
31841
31856
|
var identity = require_identity();
|
|
31842
31857
|
var Node = require_Node();
|
|
31843
|
-
function collectionFromPath(schema,
|
|
31858
|
+
function collectionFromPath(schema, path14, value) {
|
|
31844
31859
|
let v2 = value;
|
|
31845
|
-
for (let i =
|
|
31846
|
-
const k =
|
|
31860
|
+
for (let i = path14.length - 1; i >= 0; --i) {
|
|
31861
|
+
const k = path14[i];
|
|
31847
31862
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
31848
31863
|
const a = [];
|
|
31849
31864
|
a[k] = v2;
|
|
@@ -31862,7 +31877,7 @@ var require_Collection = __commonJS({
|
|
|
31862
31877
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
31863
31878
|
});
|
|
31864
31879
|
}
|
|
31865
|
-
var isEmptyPath = (
|
|
31880
|
+
var isEmptyPath = (path14) => path14 == null || typeof path14 === "object" && !!path14[Symbol.iterator]().next().done;
|
|
31866
31881
|
var Collection = class extends Node.NodeBase {
|
|
31867
31882
|
constructor(type, schema) {
|
|
31868
31883
|
super(type);
|
|
@@ -31892,11 +31907,11 @@ var require_Collection = __commonJS({
|
|
|
31892
31907
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
31893
31908
|
* that already exists in the map.
|
|
31894
31909
|
*/
|
|
31895
|
-
addIn(
|
|
31896
|
-
if (isEmptyPath(
|
|
31910
|
+
addIn(path14, value) {
|
|
31911
|
+
if (isEmptyPath(path14))
|
|
31897
31912
|
this.add(value);
|
|
31898
31913
|
else {
|
|
31899
|
-
const [key2, ...rest] =
|
|
31914
|
+
const [key2, ...rest] = path14;
|
|
31900
31915
|
const node2 = this.get(key2, true);
|
|
31901
31916
|
if (identity.isCollection(node2))
|
|
31902
31917
|
node2.addIn(rest, value);
|
|
@@ -31910,8 +31925,8 @@ var require_Collection = __commonJS({
|
|
|
31910
31925
|
* Removes a value from the collection.
|
|
31911
31926
|
* @returns `true` if the item was found and removed.
|
|
31912
31927
|
*/
|
|
31913
|
-
deleteIn(
|
|
31914
|
-
const [key2, ...rest] =
|
|
31928
|
+
deleteIn(path14) {
|
|
31929
|
+
const [key2, ...rest] = path14;
|
|
31915
31930
|
if (rest.length === 0)
|
|
31916
31931
|
return this.delete(key2);
|
|
31917
31932
|
const node2 = this.get(key2, true);
|
|
@@ -31925,8 +31940,8 @@ var require_Collection = __commonJS({
|
|
|
31925
31940
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
31926
31941
|
* `true` (collections are always returned intact).
|
|
31927
31942
|
*/
|
|
31928
|
-
getIn(
|
|
31929
|
-
const [key2, ...rest] =
|
|
31943
|
+
getIn(path14, keepScalar) {
|
|
31944
|
+
const [key2, ...rest] = path14;
|
|
31930
31945
|
const node2 = this.get(key2, true);
|
|
31931
31946
|
if (rest.length === 0)
|
|
31932
31947
|
return !keepScalar && identity.isScalar(node2) ? node2.value : node2;
|
|
@@ -31944,8 +31959,8 @@ var require_Collection = __commonJS({
|
|
|
31944
31959
|
/**
|
|
31945
31960
|
* Checks if the collection includes a value with the key `key`.
|
|
31946
31961
|
*/
|
|
31947
|
-
hasIn(
|
|
31948
|
-
const [key2, ...rest] =
|
|
31962
|
+
hasIn(path14) {
|
|
31963
|
+
const [key2, ...rest] = path14;
|
|
31949
31964
|
if (rest.length === 0)
|
|
31950
31965
|
return this.has(key2);
|
|
31951
31966
|
const node2 = this.get(key2, true);
|
|
@@ -31955,8 +31970,8 @@ var require_Collection = __commonJS({
|
|
|
31955
31970
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
31956
31971
|
* boolean to add/remove the item from the set.
|
|
31957
31972
|
*/
|
|
31958
|
-
setIn(
|
|
31959
|
-
const [key2, ...rest] =
|
|
31973
|
+
setIn(path14, value) {
|
|
31974
|
+
const [key2, ...rest] = path14;
|
|
31960
31975
|
if (rest.length === 0) {
|
|
31961
31976
|
this.set(key2, value);
|
|
31962
31977
|
} else {
|
|
@@ -34471,9 +34486,9 @@ var require_Document = __commonJS({
|
|
|
34471
34486
|
this.contents.add(value);
|
|
34472
34487
|
}
|
|
34473
34488
|
/** Adds a value to the document. */
|
|
34474
|
-
addIn(
|
|
34489
|
+
addIn(path14, value) {
|
|
34475
34490
|
if (assertCollection(this.contents))
|
|
34476
|
-
this.contents.addIn(
|
|
34491
|
+
this.contents.addIn(path14, value);
|
|
34477
34492
|
}
|
|
34478
34493
|
/**
|
|
34479
34494
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -34548,14 +34563,14 @@ var require_Document = __commonJS({
|
|
|
34548
34563
|
* Removes a value from the document.
|
|
34549
34564
|
* @returns `true` if the item was found and removed.
|
|
34550
34565
|
*/
|
|
34551
|
-
deleteIn(
|
|
34552
|
-
if (Collection.isEmptyPath(
|
|
34566
|
+
deleteIn(path14) {
|
|
34567
|
+
if (Collection.isEmptyPath(path14)) {
|
|
34553
34568
|
if (this.contents == null)
|
|
34554
34569
|
return false;
|
|
34555
34570
|
this.contents = null;
|
|
34556
34571
|
return true;
|
|
34557
34572
|
}
|
|
34558
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
34573
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path14) : false;
|
|
34559
34574
|
}
|
|
34560
34575
|
/**
|
|
34561
34576
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -34570,10 +34585,10 @@ var require_Document = __commonJS({
|
|
|
34570
34585
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
34571
34586
|
* `true` (collections are always returned intact).
|
|
34572
34587
|
*/
|
|
34573
|
-
getIn(
|
|
34574
|
-
if (Collection.isEmptyPath(
|
|
34588
|
+
getIn(path14, keepScalar) {
|
|
34589
|
+
if (Collection.isEmptyPath(path14))
|
|
34575
34590
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
34576
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
34591
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path14, keepScalar) : void 0;
|
|
34577
34592
|
}
|
|
34578
34593
|
/**
|
|
34579
34594
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -34584,10 +34599,10 @@ var require_Document = __commonJS({
|
|
|
34584
34599
|
/**
|
|
34585
34600
|
* Checks if the document includes a value at `path`.
|
|
34586
34601
|
*/
|
|
34587
|
-
hasIn(
|
|
34588
|
-
if (Collection.isEmptyPath(
|
|
34602
|
+
hasIn(path14) {
|
|
34603
|
+
if (Collection.isEmptyPath(path14))
|
|
34589
34604
|
return this.contents !== void 0;
|
|
34590
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
34605
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path14) : false;
|
|
34591
34606
|
}
|
|
34592
34607
|
/**
|
|
34593
34608
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -34604,13 +34619,13 @@ var require_Document = __commonJS({
|
|
|
34604
34619
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
34605
34620
|
* boolean to add/remove the item from the set.
|
|
34606
34621
|
*/
|
|
34607
|
-
setIn(
|
|
34608
|
-
if (Collection.isEmptyPath(
|
|
34622
|
+
setIn(path14, value) {
|
|
34623
|
+
if (Collection.isEmptyPath(path14)) {
|
|
34609
34624
|
this.contents = value;
|
|
34610
34625
|
} else if (this.contents == null) {
|
|
34611
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
34626
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path14), value);
|
|
34612
34627
|
} else if (assertCollection(this.contents)) {
|
|
34613
|
-
this.contents.setIn(
|
|
34628
|
+
this.contents.setIn(path14, value);
|
|
34614
34629
|
}
|
|
34615
34630
|
}
|
|
34616
34631
|
/**
|
|
@@ -36570,9 +36585,9 @@ var require_cst_visit = __commonJS({
|
|
|
36570
36585
|
visit2.BREAK = BREAK;
|
|
36571
36586
|
visit2.SKIP = SKIP;
|
|
36572
36587
|
visit2.REMOVE = REMOVE;
|
|
36573
|
-
visit2.itemAtPath = (cst,
|
|
36588
|
+
visit2.itemAtPath = (cst, path14) => {
|
|
36574
36589
|
let item = cst;
|
|
36575
|
-
for (const [field2, index] of
|
|
36590
|
+
for (const [field2, index] of path14) {
|
|
36576
36591
|
const tok = item?.[field2];
|
|
36577
36592
|
if (tok && "items" in tok) {
|
|
36578
36593
|
item = tok.items[index];
|
|
@@ -36581,23 +36596,23 @@ var require_cst_visit = __commonJS({
|
|
|
36581
36596
|
}
|
|
36582
36597
|
return item;
|
|
36583
36598
|
};
|
|
36584
|
-
visit2.parentCollection = (cst,
|
|
36585
|
-
const parent = visit2.itemAtPath(cst,
|
|
36586
|
-
const field2 =
|
|
36599
|
+
visit2.parentCollection = (cst, path14) => {
|
|
36600
|
+
const parent = visit2.itemAtPath(cst, path14.slice(0, -1));
|
|
36601
|
+
const field2 = path14[path14.length - 1][0];
|
|
36587
36602
|
const coll = parent?.[field2];
|
|
36588
36603
|
if (coll && "items" in coll)
|
|
36589
36604
|
return coll;
|
|
36590
36605
|
throw new Error("Parent collection not found");
|
|
36591
36606
|
};
|
|
36592
|
-
function _visit(
|
|
36593
|
-
let ctrl = visitor(item,
|
|
36607
|
+
function _visit(path14, item, visitor) {
|
|
36608
|
+
let ctrl = visitor(item, path14);
|
|
36594
36609
|
if (typeof ctrl === "symbol")
|
|
36595
36610
|
return ctrl;
|
|
36596
36611
|
for (const field2 of ["key", "value"]) {
|
|
36597
36612
|
const token = item[field2];
|
|
36598
36613
|
if (token && "items" in token) {
|
|
36599
36614
|
for (let i = 0; i < token.items.length; ++i) {
|
|
36600
|
-
const ci = _visit(Object.freeze(
|
|
36615
|
+
const ci = _visit(Object.freeze(path14.concat([[field2, i]])), token.items[i], visitor);
|
|
36601
36616
|
if (typeof ci === "number")
|
|
36602
36617
|
i = ci - 1;
|
|
36603
36618
|
else if (ci === BREAK)
|
|
@@ -36608,10 +36623,10 @@ var require_cst_visit = __commonJS({
|
|
|
36608
36623
|
}
|
|
36609
36624
|
}
|
|
36610
36625
|
if (typeof ctrl === "function" && field2 === "key")
|
|
36611
|
-
ctrl = ctrl(item,
|
|
36626
|
+
ctrl = ctrl(item, path14);
|
|
36612
36627
|
}
|
|
36613
36628
|
}
|
|
36614
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
36629
|
+
return typeof ctrl === "function" ? ctrl(item, path14) : ctrl;
|
|
36615
36630
|
}
|
|
36616
36631
|
exports2.visit = visit2;
|
|
36617
36632
|
}
|
|
@@ -38594,7 +38609,7 @@ function stripAttachmentNote(text5) {
|
|
|
38594
38609
|
if (annotationsNote) content = content.slice(0, annotationsNote.index).trim();
|
|
38595
38610
|
return {
|
|
38596
38611
|
content,
|
|
38597
|
-
files: match ? [...match[1].matchAll(/^- (.+)$/gm)].map(([,
|
|
38612
|
+
files: match ? [...match[1].matchAll(/^- (.+)$/gm)].map(([, path14]) => path14) : [],
|
|
38598
38613
|
walkthroughs,
|
|
38599
38614
|
appshots,
|
|
38600
38615
|
annotations: annotationsNote ? parseAnnotationsNote(annotationsNote.body) : []
|
|
@@ -38633,7 +38648,7 @@ var init_user_message_attachments = __esm({
|
|
|
38633
38648
|
WALKTHROUGH_NOTE_REGEX = /(?:^|\n\n)<replicas_walkthrough path="([^"\n]+)" duration_seconds="(\d+)" audio="(true|false)">\n[^<]*\n<\/replicas_walkthrough>$/;
|
|
38634
38649
|
TRUNCATED_WALKTHROUGH_NOTE_REGEX = /(?:^|\n\n)<replicas_walkthrough path="([^"\n]*)(?:" duration_seconds="(\d*))?(?:" audio="(true)?)?[^<]*(?:<\/?[a-z_]*)?$/;
|
|
38635
38650
|
VIDEO_SIZES_REGEX = /<replicas_instructions>\nThe attached videos' frame sizes, in pixels:((?:\n- .+: \d+x\d+)+)(?:\nFor display only; ignore\.)?\n<\/replicas_instructions>/;
|
|
38636
|
-
parseVideoSizes = (raw) => Object.fromEntries([...(raw.match(VIDEO_SIZES_REGEX)?.[1] ?? "").matchAll(/^- (.+): (\d+)x(\d+)$/gm)].map(([,
|
|
38651
|
+
parseVideoSizes = (raw) => Object.fromEntries([...(raw.match(VIDEO_SIZES_REGEX)?.[1] ?? "").matchAll(/^- (.+): (\d+)x(\d+)$/gm)].map(([, path14, width, height]) => [path14, { width: Number(width), height: Number(height) }]));
|
|
38637
38652
|
}
|
|
38638
38653
|
});
|
|
38639
38654
|
|
|
@@ -40014,7 +40029,7 @@ function parseOpencodeEvents(events) {
|
|
|
40014
40029
|
upsertDisplayMessage(messages, {
|
|
40015
40030
|
id,
|
|
40016
40031
|
type: "file_change",
|
|
40017
|
-
changes: files.map((
|
|
40032
|
+
changes: files.map((path14) => ({ path: path14, kind: "update" })),
|
|
40018
40033
|
status: "completed",
|
|
40019
40034
|
timestamp: timestamp2
|
|
40020
40035
|
});
|
|
@@ -43165,7 +43180,7 @@ var CLI_VERSION;
|
|
|
43165
43180
|
var init_cli_version = __esm({
|
|
43166
43181
|
"../shared/src/cli-version.ts"() {
|
|
43167
43182
|
"use strict";
|
|
43168
|
-
CLI_VERSION = "0.3.
|
|
43183
|
+
CLI_VERSION = "0.3.641";
|
|
43169
43184
|
}
|
|
43170
43185
|
});
|
|
43171
43186
|
|
|
@@ -55437,15 +55452,34 @@ async function waitForUser(params) {
|
|
|
55437
55452
|
}
|
|
55438
55453
|
return params.settled(value) ? value : params.poll(false);
|
|
55439
55454
|
}
|
|
55440
|
-
|
|
55455
|
+
function readUploadFile(filePath) {
|
|
55456
|
+
const absPath = import_path2.default.resolve(filePath);
|
|
55457
|
+
if (!import_fs2.default.existsSync(absPath)) throw new Error(`File not found: ${absPath}`);
|
|
55458
|
+
if (!import_fs2.default.statSync(absPath).isFile()) throw new Error(`Not a file: ${absPath}`);
|
|
55459
|
+
const body2 = import_fs2.default.readFileSync(absPath);
|
|
55460
|
+
if (body2.length === 0) throw new Error("File is empty");
|
|
55461
|
+
return { fileName: import_path2.default.basename(absPath), body: body2 };
|
|
55462
|
+
}
|
|
55463
|
+
function requireNamePerFile(filePaths, names) {
|
|
55464
|
+
if (filePaths.length === 0) throw new Error("No files specified");
|
|
55465
|
+
if (names.length !== filePaths.length) {
|
|
55466
|
+
throw new Error(`Each file needs a --name. Got ${filePaths.length} file(s) and ${names.length} --name value(s); pass one --name per file, in order.`);
|
|
55467
|
+
}
|
|
55468
|
+
if (names.some((name) => !name.trim())) throw new Error("--name must not be empty.");
|
|
55469
|
+
return names;
|
|
55470
|
+
}
|
|
55471
|
+
var import_chalk6, import_fs2, import_path2, import_prompts10, markdownLabel;
|
|
55441
55472
|
var init_command_utils = __esm({
|
|
55442
55473
|
"src/lib/command-utils.ts"() {
|
|
55443
55474
|
"use strict";
|
|
55444
55475
|
import_chalk6 = __toESM(require("chalk"));
|
|
55476
|
+
import_fs2 = __toESM(require("fs"));
|
|
55477
|
+
import_path2 = __toESM(require("path"));
|
|
55445
55478
|
init_src();
|
|
55446
55479
|
import_prompts10 = __toESM(require("prompts"));
|
|
55447
55480
|
init_config();
|
|
55448
55481
|
init_output();
|
|
55482
|
+
markdownLabel = (name) => name.replace(/[[\]]/g, "");
|
|
55449
55483
|
}
|
|
55450
55484
|
});
|
|
55451
55485
|
|
|
@@ -55689,7 +55723,7 @@ function getGitRoot() {
|
|
|
55689
55723
|
}
|
|
55690
55724
|
function getGitRepoName() {
|
|
55691
55725
|
const root = getGitRoot();
|
|
55692
|
-
return
|
|
55726
|
+
return import_path3.default.basename(root);
|
|
55693
55727
|
}
|
|
55694
55728
|
function isInsideGitRepo() {
|
|
55695
55729
|
try {
|
|
@@ -55702,12 +55736,12 @@ function isInsideGitRepo() {
|
|
|
55702
55736
|
return false;
|
|
55703
55737
|
}
|
|
55704
55738
|
}
|
|
55705
|
-
var import_child_process2,
|
|
55739
|
+
var import_child_process2, import_path3;
|
|
55706
55740
|
var init_git2 = __esm({
|
|
55707
55741
|
"src/lib/git.ts"() {
|
|
55708
55742
|
"use strict";
|
|
55709
55743
|
import_child_process2 = require("child_process");
|
|
55710
|
-
|
|
55744
|
+
import_path3 = __toESM(require("path"));
|
|
55711
55745
|
}
|
|
55712
55746
|
});
|
|
55713
55747
|
|
|
@@ -55843,21 +55877,21 @@ var init_connect = __esm({
|
|
|
55843
55877
|
|
|
55844
55878
|
// src/lib/ssh-config.ts
|
|
55845
55879
|
function ensureSSHDir() {
|
|
55846
|
-
const sshDir =
|
|
55847
|
-
if (!
|
|
55848
|
-
|
|
55880
|
+
const sshDir = import_path4.default.join(import_os2.default.homedir(), ".ssh");
|
|
55881
|
+
if (!import_fs3.default.existsSync(sshDir)) {
|
|
55882
|
+
import_fs3.default.mkdirSync(sshDir, { recursive: true, mode: 448 });
|
|
55849
55883
|
}
|
|
55850
55884
|
}
|
|
55851
55885
|
function readSSHConfig() {
|
|
55852
55886
|
ensureSSHDir();
|
|
55853
|
-
if (!
|
|
55887
|
+
if (!import_fs3.default.existsSync(SSH_CONFIG_PATH)) {
|
|
55854
55888
|
return "";
|
|
55855
55889
|
}
|
|
55856
|
-
return
|
|
55890
|
+
return import_fs3.default.readFileSync(SSH_CONFIG_PATH, "utf-8");
|
|
55857
55891
|
}
|
|
55858
55892
|
function writeSSHConfig(content) {
|
|
55859
55893
|
ensureSSHDir();
|
|
55860
|
-
|
|
55894
|
+
import_fs3.default.writeFileSync(SSH_CONFIG_PATH, content, { mode: 384 });
|
|
55861
55895
|
}
|
|
55862
55896
|
function sanitizeSSHConfigValue(value) {
|
|
55863
55897
|
return value.replace(/[\r\n]+/g, " ").trim();
|
|
@@ -55922,14 +55956,14 @@ function addOrUpdateSSHConfigEntry(entry) {
|
|
|
55922
55956
|
function getWorkspaceHostAlias(workspaceName) {
|
|
55923
55957
|
return `replicas-${workspaceName.toLowerCase().replace(/[^a-z0-9-]/g, "-")}`;
|
|
55924
55958
|
}
|
|
55925
|
-
var
|
|
55959
|
+
var import_fs3, import_path4, import_os2, SSH_CONFIG_PATH, REPLICAS_MARKER_START, REPLICAS_MARKER_END;
|
|
55926
55960
|
var init_ssh_config = __esm({
|
|
55927
55961
|
"src/lib/ssh-config.ts"() {
|
|
55928
55962
|
"use strict";
|
|
55929
|
-
|
|
55930
|
-
|
|
55963
|
+
import_fs3 = __toESM(require("fs"));
|
|
55964
|
+
import_path4 = __toESM(require("path"));
|
|
55931
55965
|
import_os2 = __toESM(require("os"));
|
|
55932
|
-
SSH_CONFIG_PATH =
|
|
55966
|
+
SSH_CONFIG_PATH = import_path4.default.join(import_os2.default.homedir(), ".ssh", "config");
|
|
55933
55967
|
REPLICAS_MARKER_START = "# === REPLICAS CLI MANAGED ENTRY START ===";
|
|
55934
55968
|
REPLICAS_MARKER_END = "# === REPLICAS CLI MANAGED ENTRY END ===";
|
|
55935
55969
|
}
|
|
@@ -56625,8 +56659,8 @@ var init_claude_auth2 = __esm({
|
|
|
56625
56659
|
});
|
|
56626
56660
|
|
|
56627
56661
|
// src/lib/muse-oauth.ts
|
|
56628
|
-
async function post(
|
|
56629
|
-
return fetch(`${AUTH_URL}${
|
|
56662
|
+
async function post(path14, body2) {
|
|
56663
|
+
return fetch(`${AUTH_URL}${path14}`, {
|
|
56630
56664
|
method: "POST",
|
|
56631
56665
|
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
56632
56666
|
body: body2
|
|
@@ -56799,21 +56833,21 @@ startHook:
|
|
|
56799
56833
|
function initCommand(options) {
|
|
56800
56834
|
const isYaml = options.yaml ?? false;
|
|
56801
56835
|
const targetFilename = isYaml ? "replicas.yaml" : "replicas.json";
|
|
56802
|
-
const configPath =
|
|
56836
|
+
const configPath = import_path5.default.join(process.cwd(), targetFilename);
|
|
56803
56837
|
for (const filename of REPLICAS_CONFIG_FILENAMES) {
|
|
56804
|
-
if (
|
|
56838
|
+
if (import_fs4.default.existsSync(import_path5.default.join(process.cwd(), filename)) && !options.force) {
|
|
56805
56839
|
throw new Error(`${filename} already exists in this directory. Use --force to overwrite the existing file.`);
|
|
56806
56840
|
}
|
|
56807
56841
|
}
|
|
56808
56842
|
const configContent = isYaml ? getDefaultYamlContent() : JSON.stringify(getDefaultConfig(), null, 2) + "\n";
|
|
56809
56843
|
try {
|
|
56810
|
-
|
|
56844
|
+
import_fs4.default.writeFileSync(configPath, configContent, "utf-8");
|
|
56811
56845
|
} catch (error62) {
|
|
56812
56846
|
throw new Error(
|
|
56813
56847
|
`Failed to create ${targetFilename}: ${error62 instanceof Error ? error62.message : "Unknown error"}`
|
|
56814
56848
|
);
|
|
56815
56849
|
}
|
|
56816
|
-
const higherPriority = REPLICAS_CONFIG_FILENAMES.slice(0, REPLICAS_CONFIG_FILENAMES.indexOf(targetFilename)).filter((filename) =>
|
|
56850
|
+
const higherPriority = REPLICAS_CONFIG_FILENAMES.slice(0, REPLICAS_CONFIG_FILENAMES.indexOf(targetFilename)).filter((filename) => import_fs4.default.existsSync(import_path5.default.join(process.cwd(), filename)));
|
|
56817
56851
|
output2({ path: configPath, shadowed_by: higherPriority }, () => {
|
|
56818
56852
|
console.log(import_chalk17.default.green(`\u2713 Created ${targetFilename}`));
|
|
56819
56853
|
for (const filename of higherPriority) {
|
|
@@ -56831,13 +56865,13 @@ function initCommand(options) {
|
|
|
56831
56865
|
}
|
|
56832
56866
|
});
|
|
56833
56867
|
}
|
|
56834
|
-
var import_chalk17,
|
|
56868
|
+
var import_chalk17, import_fs4, import_path5;
|
|
56835
56869
|
var init_init = __esm({
|
|
56836
56870
|
"src/commands/init.ts"() {
|
|
56837
56871
|
"use strict";
|
|
56838
56872
|
import_chalk17 = __toESM(require("chalk"));
|
|
56839
|
-
|
|
56840
|
-
|
|
56873
|
+
import_fs4 = __toESM(require("fs"));
|
|
56874
|
+
import_path5 = __toESM(require("path"));
|
|
56841
56875
|
init_src();
|
|
56842
56876
|
init_output();
|
|
56843
56877
|
}
|
|
@@ -56900,7 +56934,7 @@ async function credentialsGetCommand(service, options) {
|
|
|
56900
56934
|
});
|
|
56901
56935
|
}
|
|
56902
56936
|
async function credentialsSetCommand(service, options) {
|
|
56903
|
-
const
|
|
56937
|
+
const path14 = credentialsPath(service, options, true);
|
|
56904
56938
|
const { org: org2, models, ...fields } = options;
|
|
56905
56939
|
const secretField = service === "bedrock" ? "aws_secret_access_key" : "api_key";
|
|
56906
56940
|
const body2 = {
|
|
@@ -56908,7 +56942,7 @@ async function credentialsSetCommand(service, options) {
|
|
|
56908
56942
|
...models ? { models: models.split(",").map((model2) => model2.trim()).filter(Boolean) } : {},
|
|
56909
56943
|
[secretField]: await readSecret(service, secretField === "api_key" ? "API key" : "AWS secret access key")
|
|
56910
56944
|
};
|
|
56911
|
-
const response = await orgAuthenticatedFetch(
|
|
56945
|
+
const response = await orgAuthenticatedFetch(path14, { method: "POST", body: body2 });
|
|
56912
56946
|
output2(response, () => console.log(import_chalk18.default.green(`Saved ${scopeLabel(options)} ${service} credentials.`)));
|
|
56913
56947
|
}
|
|
56914
56948
|
async function credentialsRemoveCommand(service, options) {
|
|
@@ -57399,7 +57433,7 @@ async function envVarsRequestCommand(requiredKeys, options) {
|
|
|
57399
57433
|
const invalid = keys.find((key2) => !VARIABLE_KEY_RE.test(key2));
|
|
57400
57434
|
if (invalid) throw new Error(`${invalid} is not a valid environment variable name`);
|
|
57401
57435
|
const timeoutMs = parseRequestTimeout(options.timeout);
|
|
57402
|
-
const readRuntimeEnv = () =>
|
|
57436
|
+
const readRuntimeEnv = () => import_fs5.default.existsSync(RUNTIME_ENV_FILE) ? import_fs5.default.readFileSync(RUNTIME_ENV_FILE, "utf8") : "";
|
|
57403
57437
|
const local = parsePosixEnvFile(readRuntimeEnv());
|
|
57404
57438
|
const available = options.replace ? [] : keys.filter((key2) => Object.hasOwn(local, key2) && local[key2].length > 0);
|
|
57405
57439
|
const wanted = keys.filter((key2) => !available.includes(key2));
|
|
@@ -57436,9 +57470,9 @@ async function envVarsRequestCommand(requiredKeys, options) {
|
|
|
57436
57470
|
const variables = loaded.variables.filter((variable) => !variable.key.startsWith("REPLICAS_"));
|
|
57437
57471
|
const existing = parsePosixEnv(readRuntimeEnv());
|
|
57438
57472
|
const env = { ...existing.values, ...Object.fromEntries(variables.map((variable) => [variable.key, variable.value])) };
|
|
57439
|
-
|
|
57440
|
-
|
|
57441
|
-
|
|
57473
|
+
import_fs5.default.mkdirSync(import_path6.default.dirname(RUNTIME_ENV_FILE), { recursive: true });
|
|
57474
|
+
import_fs5.default.writeFileSync(RUNTIME_ENV_FILE, serializePosixEnvFile(env, existing.unsetKeys.filter((key2) => !env[key2])), { mode: 384 });
|
|
57475
|
+
import_fs5.default.chmodSync(RUNTIME_ENV_FILE, 384);
|
|
57442
57476
|
exported = [...variables.map((variable) => variable.key), ...loaded.already_loaded];
|
|
57443
57477
|
}
|
|
57444
57478
|
if (request2.status !== "pending") await orgAuthenticatedFetch(`/v1/variable-requests/${request2.id}/ack`, { method: "POST" });
|
|
@@ -57497,10 +57531,10 @@ Files (${environment_files.length}):
|
|
|
57497
57531
|
}
|
|
57498
57532
|
function readFileContent(options) {
|
|
57499
57533
|
if (options.file) {
|
|
57500
|
-
if (!
|
|
57534
|
+
if (!import_fs5.default.existsSync(options.file)) {
|
|
57501
57535
|
throw new Error(`Local file not found: ${options.file}`);
|
|
57502
57536
|
}
|
|
57503
|
-
return
|
|
57537
|
+
return import_fs5.default.readFileSync(options.file, "utf-8");
|
|
57504
57538
|
}
|
|
57505
57539
|
if (options.content !== void 0) return options.content;
|
|
57506
57540
|
throw new Error('Pass either --content "..." or --file <local-path>');
|
|
@@ -57830,20 +57864,20 @@ function envWarmPoolCommand(enabled) {
|
|
|
57830
57864
|
output2(response, () => console.log(import_chalk21.default.green(`Warm pool ${enabled ? "enabled" : "disabled"}`)));
|
|
57831
57865
|
};
|
|
57832
57866
|
}
|
|
57833
|
-
var
|
|
57867
|
+
var import_fs5, import_os3, import_path6, import_chalk21, RUNTIME_ENV_FILE;
|
|
57834
57868
|
var init_environment3 = __esm({
|
|
57835
57869
|
"src/commands/environment.ts"() {
|
|
57836
57870
|
"use strict";
|
|
57837
|
-
|
|
57871
|
+
import_fs5 = __toESM(require("fs"));
|
|
57838
57872
|
import_os3 = __toESM(require("os"));
|
|
57839
|
-
|
|
57873
|
+
import_path6 = __toESM(require("path"));
|
|
57840
57874
|
import_chalk21 = __toESM(require("chalk"));
|
|
57841
57875
|
init_api2();
|
|
57842
57876
|
init_command_utils();
|
|
57843
57877
|
init_output();
|
|
57844
57878
|
init_src();
|
|
57845
57879
|
init_repositories2();
|
|
57846
|
-
RUNTIME_ENV_FILE =
|
|
57880
|
+
RUNTIME_ENV_FILE = import_path6.default.join(import_os3.default.homedir(), ".replicas", "runtime-env.sh");
|
|
57847
57881
|
}
|
|
57848
57882
|
});
|
|
57849
57883
|
|
|
@@ -58426,7 +58460,7 @@ async function canvasGetCommand(id, filename) {
|
|
|
58426
58460
|
output2(file2, ({ content }) => process.stdout.write(content ?? ""));
|
|
58427
58461
|
}
|
|
58428
58462
|
async function canvasPutCommand(id, filename, options) {
|
|
58429
|
-
const content = options.file ? options.content ? void 0 :
|
|
58463
|
+
const content = options.file ? options.content ? void 0 : import_fs6.default.readFileSync(options.file, "utf-8") : options.content;
|
|
58430
58464
|
if (content === void 0) throw new Error("Pass exactly one of --content or --file");
|
|
58431
58465
|
const { revision } = await getCanvasFile(id, filename);
|
|
58432
58466
|
const body2 = {
|
|
@@ -58440,11 +58474,11 @@ async function canvasPutCommand(id, filename, options) {
|
|
|
58440
58474
|
if (!result.saved) throw new Error(`${filename} changed while saving; retry`);
|
|
58441
58475
|
output2(result, () => console.log(import_chalk23.default.green(`Saved ${filename}`)));
|
|
58442
58476
|
}
|
|
58443
|
-
var
|
|
58477
|
+
var import_fs6, import_chalk23, getCanvasFile;
|
|
58444
58478
|
var init_workspace = __esm({
|
|
58445
58479
|
"src/commands/workspace.ts"() {
|
|
58446
58480
|
"use strict";
|
|
58447
|
-
|
|
58481
|
+
import_fs6 = __toESM(require("fs"));
|
|
58448
58482
|
import_chalk23 = __toESM(require("chalk"));
|
|
58449
58483
|
init_src();
|
|
58450
58484
|
init_api2();
|
|
@@ -58540,8 +58574,8 @@ async function chatQueueListCommand(id, chatId) {
|
|
|
58540
58574
|
printQueue(queue);
|
|
58541
58575
|
});
|
|
58542
58576
|
}
|
|
58543
|
-
async function mutateQueue(
|
|
58544
|
-
output2(await orgAuthenticatedFetch(
|
|
58577
|
+
async function mutateQueue(path14, method, body2) {
|
|
58578
|
+
output2(await orgAuthenticatedFetch(path14, { method, body: body2 }), ({ queue }) => {
|
|
58545
58579
|
if (queue) printQueue(queue);
|
|
58546
58580
|
else console.log("Done.");
|
|
58547
58581
|
});
|
|
@@ -58555,7 +58589,7 @@ var init_chat = __esm({
|
|
|
58555
58589
|
init_api2();
|
|
58556
58590
|
init_output();
|
|
58557
58591
|
init_replica2();
|
|
58558
|
-
chatPath2 = (id, chatId,
|
|
58592
|
+
chatPath2 = (id, chatId, path14 = "") => `/v1/replica/${id}/chats/${chatId}${path14}`;
|
|
58559
58593
|
chatQueueClearCommand = (id, chatId) => mutateQueue(chatPath2(id, chatId, "/queue"), "DELETE");
|
|
58560
58594
|
chatQueueRemoveCommand = (id, chatId, messageId) => mutateQueue(chatPath2(id, chatId, `/queue/${messageId}`), "DELETE");
|
|
58561
58595
|
chatQueueEditCommand = (id, chatId, messageId, message2) => mutateQueue(chatPath2(id, chatId, `/queue/${messageId}`), "PATCH", { message: message2 });
|
|
@@ -58606,7 +58640,7 @@ var init_plugins3 = __esm({
|
|
|
58606
58640
|
init_command_utils();
|
|
58607
58641
|
init_output();
|
|
58608
58642
|
init_environment3();
|
|
58609
|
-
pluginsPath = async ({ env },
|
|
58643
|
+
pluginsPath = async ({ env }, path14) => env ? `/v1/environments/${await resolveEnvironmentId(env)}/plugins${path14}` : `/v1/plugins${path14}`;
|
|
58610
58644
|
}
|
|
58611
58645
|
});
|
|
58612
58646
|
|
|
@@ -58655,7 +58689,7 @@ async function environmentSetupStepCommand(key2, status) {
|
|
|
58655
58689
|
}
|
|
58656
58690
|
function readJsonFile(file2, label) {
|
|
58657
58691
|
try {
|
|
58658
|
-
return JSON.parse(
|
|
58692
|
+
return JSON.parse(import_fs7.default.readFileSync(file2, "utf8"));
|
|
58659
58693
|
} catch (error62) {
|
|
58660
58694
|
throw new Error(`Could not read ${label} JSON from ${file2}: ${error62 instanceof Error ? error62.message : String(error62)}`);
|
|
58661
58695
|
}
|
|
@@ -58678,11 +58712,11 @@ async function environmentSetupProposeCommand(options) {
|
|
|
58678
58712
|
console.log(import_chalk26.default.gray("\n The user reviews and saves it from the Environment panel; nothing has been applied yet.\n"));
|
|
58679
58713
|
});
|
|
58680
58714
|
}
|
|
58681
|
-
var
|
|
58715
|
+
var import_fs7, import_chalk26, STEP_KEYS;
|
|
58682
58716
|
var init_environment_setup2 = __esm({
|
|
58683
58717
|
"src/commands/environment-setup.ts"() {
|
|
58684
58718
|
"use strict";
|
|
58685
|
-
|
|
58719
|
+
import_fs7 = __toESM(require("fs"));
|
|
58686
58720
|
import_chalk26 = __toESM(require("chalk"));
|
|
58687
58721
|
init_api2();
|
|
58688
58722
|
init_command_utils();
|
|
@@ -58693,6 +58727,19 @@ var init_environment_setup2 = __esm({
|
|
|
58693
58727
|
}
|
|
58694
58728
|
});
|
|
58695
58729
|
|
|
58730
|
+
// src/lib/members.ts
|
|
58731
|
+
async function findMemberUserId(emailOrId) {
|
|
58732
|
+
const { members: members2 } = await orgAuthenticatedFetch("/v1/organization/members");
|
|
58733
|
+
const member = members2.find((m) => m.user_id === emailOrId || m.email.toLowerCase() === emailOrId.toLowerCase());
|
|
58734
|
+
return member?.user_id ?? null;
|
|
58735
|
+
}
|
|
58736
|
+
var init_members = __esm({
|
|
58737
|
+
"src/lib/members.ts"() {
|
|
58738
|
+
"use strict";
|
|
58739
|
+
init_api2();
|
|
58740
|
+
}
|
|
58741
|
+
});
|
|
58742
|
+
|
|
58696
58743
|
// src/commands/automation.ts
|
|
58697
58744
|
function parseScopeFilter(value) {
|
|
58698
58745
|
if (!value) return void 0;
|
|
@@ -58964,10 +59011,9 @@ async function resolveCredentialsMember(value) {
|
|
|
58964
59011
|
if (!user) throw new Error("--credentials me needs a signed-in user; pass a member email instead");
|
|
58965
59012
|
return user.id;
|
|
58966
59013
|
}
|
|
58967
|
-
const
|
|
58968
|
-
|
|
58969
|
-
|
|
58970
|
-
return member.user_id;
|
|
59014
|
+
const userId = await findMemberUserId(value);
|
|
59015
|
+
if (!userId) throw new Error(`No organization member matches "${value}". Use me, org, or a member email`);
|
|
59016
|
+
return userId;
|
|
58971
59017
|
}
|
|
58972
59018
|
async function automationListCommand(options) {
|
|
58973
59019
|
ensureOrgApiAuthenticated();
|
|
@@ -59578,6 +59624,7 @@ var init_automation = __esm({
|
|
|
59578
59624
|
init_output();
|
|
59579
59625
|
init_api2();
|
|
59580
59626
|
init_config();
|
|
59627
|
+
init_members();
|
|
59581
59628
|
init_command_utils();
|
|
59582
59629
|
init_src();
|
|
59583
59630
|
DURATION_UNIT_MS = { m: 6e4, h: 36e5, d: 864e5, w: 6048e5 };
|
|
@@ -59585,10 +59632,10 @@ var init_automation = __esm({
|
|
|
59585
59632
|
});
|
|
59586
59633
|
|
|
59587
59634
|
// src/lib/agent-api.ts
|
|
59588
|
-
async function agentFetch(
|
|
59589
|
-
return (await agentRequest(
|
|
59635
|
+
async function agentFetch(path14, options) {
|
|
59636
|
+
return (await agentRequest(path14, options)).json();
|
|
59590
59637
|
}
|
|
59591
|
-
async function agentRequest(
|
|
59638
|
+
async function agentRequest(path14, options) {
|
|
59592
59639
|
const config3 = readAgentConfig();
|
|
59593
59640
|
if (!config3) {
|
|
59594
59641
|
throw new Error("Agent mode config not found");
|
|
@@ -59604,7 +59651,7 @@ async function agentRequest(path13, options) {
|
|
|
59604
59651
|
...options?.headers || {}
|
|
59605
59652
|
};
|
|
59606
59653
|
const body2 = rawBody === void 0 ? void 0 : rawBody instanceof FormData || rawBody instanceof ReadableStream ? rawBody : JSON.stringify(rawBody);
|
|
59607
|
-
const response = await fetch(`${MONOLITH_URL}${
|
|
59654
|
+
const response = await fetch(`${MONOLITH_URL}${path14}`, {
|
|
59608
59655
|
...options,
|
|
59609
59656
|
headers,
|
|
59610
59657
|
body: body2,
|
|
@@ -59616,7 +59663,7 @@ async function agentRequest(path13, options) {
|
|
|
59616
59663
|
}
|
|
59617
59664
|
return response;
|
|
59618
59665
|
}
|
|
59619
|
-
async function engineFetch(
|
|
59666
|
+
async function engineFetch(path14, options) {
|
|
59620
59667
|
const config3 = readAgentConfig();
|
|
59621
59668
|
if (!config3) {
|
|
59622
59669
|
throw new Error("Agent mode config not found");
|
|
@@ -59626,7 +59673,7 @@ async function engineFetch(path13, options) {
|
|
|
59626
59673
|
"Content-Type": "application/json",
|
|
59627
59674
|
...options?.headers || {}
|
|
59628
59675
|
};
|
|
59629
|
-
const response = await fetch(`http://localhost:${ENGINE_PORT2}${
|
|
59676
|
+
const response = await fetch(`http://localhost:${ENGINE_PORT2}${path14}`, {
|
|
59630
59677
|
...options,
|
|
59631
59678
|
headers,
|
|
59632
59679
|
body: options?.body !== void 0 ? JSON.stringify(options.body) : void 0
|
|
@@ -59824,21 +59871,9 @@ async function uploadMedia(file2, fileName, fields) {
|
|
|
59824
59871
|
return media2;
|
|
59825
59872
|
}
|
|
59826
59873
|
async function uploadOne(filePath, displayName, kind, options) {
|
|
59827
|
-
const
|
|
59828
|
-
|
|
59829
|
-
throw new Error(`File not found: ${absPath}`);
|
|
59830
|
-
}
|
|
59831
|
-
const stat = import_fs7.default.statSync(absPath);
|
|
59832
|
-
if (!stat.isFile()) {
|
|
59833
|
-
throw new Error(`Not a file: ${absPath}`);
|
|
59834
|
-
}
|
|
59835
|
-
if (stat.size === 0) {
|
|
59836
|
-
throw new Error("File is empty");
|
|
59837
|
-
}
|
|
59838
|
-
const fileName = import_path6.default.basename(absPath);
|
|
59839
|
-
const ext = import_path6.default.extname(absPath).slice(1).toLowerCase();
|
|
59874
|
+
const { fileName, body: body2 } = readUploadFile(filePath);
|
|
59875
|
+
const ext = import_path7.default.extname(fileName).slice(1).toLowerCase();
|
|
59840
59876
|
const contentType = mediaInfo(ext)?.contentType ?? "application/octet-stream";
|
|
59841
|
-
const body2 = import_fs7.default.readFileSync(absPath);
|
|
59842
59877
|
const media2 = await uploadMedia(new Blob([body2], { type: contentType }), fileName, {
|
|
59843
59878
|
kind,
|
|
59844
59879
|
display_name: displayName,
|
|
@@ -59847,9 +59882,7 @@ async function uploadOne(filePath, displayName, kind, options) {
|
|
|
59847
59882
|
return { media: media2, imageSize: kind === MEDIA_KIND.IMAGE ? readImageSize((offset) => body2.subarray(offset)) : null };
|
|
59848
59883
|
}
|
|
59849
59884
|
async function mediaUploadCommand(filePaths, options) {
|
|
59850
|
-
|
|
59851
|
-
throw new Error("No files specified");
|
|
59852
|
-
}
|
|
59885
|
+
const names = requireNamePerFile(filePaths, options.name ?? []);
|
|
59853
59886
|
if (options.kind && !isMediaKind(options.kind)) {
|
|
59854
59887
|
throw new Error(`Invalid kind '${options.kind}'. Must be one of: ${MEDIA_KINDS.join(", ")}`);
|
|
59855
59888
|
}
|
|
@@ -59859,18 +59892,9 @@ async function mediaUploadCommand(filePaths, options) {
|
|
|
59859
59892
|
if (options.share && options.access) {
|
|
59860
59893
|
throw new Error("Pass either --share or --access, not both. --share is an alias for --access public.");
|
|
59861
59894
|
}
|
|
59862
|
-
const names = options.name ?? [];
|
|
59863
|
-
if (names.length !== filePaths.length) {
|
|
59864
|
-
throw new Error(
|
|
59865
|
-
`Each file needs a --name. Got ${filePaths.length} file(s) and ${names.length} --name value(s); pass one --name per file, in order.`
|
|
59866
|
-
);
|
|
59867
|
-
}
|
|
59868
|
-
if (names.some((name) => !name.trim())) {
|
|
59869
|
-
throw new Error("--name must not be empty.");
|
|
59870
|
-
}
|
|
59871
59895
|
const publicAccess = options.share || options.access === "public";
|
|
59872
59896
|
const kinds = filePaths.map((filePath) => {
|
|
59873
|
-
const ext =
|
|
59897
|
+
const ext = import_path7.default.extname(filePath).slice(1).toLowerCase();
|
|
59874
59898
|
return resolveKind(ext, options.kind);
|
|
59875
59899
|
});
|
|
59876
59900
|
if (kinds.includes(MEDIA_KIND.HTML)) {
|
|
@@ -59971,22 +59995,21 @@ async function mediaUrlCommand(mediaId) {
|
|
|
59971
59995
|
const response = await orgAuthenticatedFetch(`/v1/media/${mediaId}/url`);
|
|
59972
59996
|
output2(response, ({ url: url2 }) => console.log(url2));
|
|
59973
59997
|
}
|
|
59974
|
-
var
|
|
59998
|
+
var import_path7, MEDIA_ACCESS_VALUES, MEDIA_DELIVERY_HINT;
|
|
59975
59999
|
var init_media3 = __esm({
|
|
59976
60000
|
"src/commands/media.ts"() {
|
|
59977
60001
|
"use strict";
|
|
59978
|
-
|
|
59979
|
-
import_path6 = __toESM(require("path"));
|
|
60002
|
+
import_path7 = __toESM(require("path"));
|
|
59980
60003
|
init_agent_api();
|
|
59981
60004
|
init_api2();
|
|
59982
60005
|
init_config();
|
|
59983
60006
|
init_monolith_url();
|
|
59984
60007
|
init_media_url();
|
|
60008
|
+
init_command_utils();
|
|
59985
60009
|
init_output();
|
|
59986
60010
|
init_src();
|
|
59987
60011
|
MEDIA_ACCESS_VALUES = ["organization", "public"];
|
|
59988
60012
|
MEDIA_DELIVERY_HINT = "Next: paste each media line above (`` or `[\u2026](\u2026)`) verbatim into your Replicas chat reply so it renders inline; View in Replicas links are secondary and never replace it. Slack, Linear, and GitLab also need a native upload of the file bytes; see the replicas-agent skill's references/MEDIA.md.";
|
|
59989
|
-
markdownLabel = (name) => name.replace(/[[\]]/g, "");
|
|
59990
60013
|
}
|
|
59991
60014
|
});
|
|
59992
60015
|
|
|
@@ -60008,10 +60031,10 @@ function gifFilter({ fps, width, crop }) {
|
|
|
60008
60031
|
].filter(Boolean).join(",");
|
|
60009
60032
|
}
|
|
60010
60033
|
async function mediaGifCommand(input2, options) {
|
|
60011
|
-
const source =
|
|
60034
|
+
const source = import_path8.default.resolve(input2);
|
|
60012
60035
|
if (!import_fs8.default.existsSync(source) || !import_fs8.default.statSync(source).isFile()) throw new Error(`File not found: ${source}`);
|
|
60013
|
-
const target =
|
|
60014
|
-
if (
|
|
60036
|
+
const target = import_path8.default.resolve(options.output ?? `${source.replace(/\.[^./]+$/, "")}.gif`);
|
|
60037
|
+
if (import_path8.default.extname(target).toLowerCase() !== ".gif") throw new Error("--output must end in .gif");
|
|
60015
60038
|
if (target === source) throw new Error("--output must differ from the input file");
|
|
60016
60039
|
if (options.crop && !/^\d+:\d+:\d+:\d+$/.test(options.crop)) {
|
|
60017
60040
|
throw new Error(`--crop must be width:height:x:y in pixels of the recording, got '${options.crop}'`);
|
|
@@ -60020,7 +60043,7 @@ async function mediaGifCommand(input2, options) {
|
|
|
60020
60043
|
const duration3 = parseOption(options.duration, 10, "--duration", 1, 30);
|
|
60021
60044
|
const maxWidth = parseOption(options.width, 960, "--width", 200, 1280);
|
|
60022
60045
|
const maxFps = parseOption(options.fps, 12, "--fps", 5, 20);
|
|
60023
|
-
const temp =
|
|
60046
|
+
const temp = import_path8.default.join(import_path8.default.dirname(target), `.${import_path8.default.basename(target, ".gif")}.${process.pid}.tmp.gif`);
|
|
60024
60047
|
let fps = maxFps;
|
|
60025
60048
|
let width = maxWidth;
|
|
60026
60049
|
try {
|
|
@@ -60063,13 +60086,13 @@ async function mediaGifCommand(input2, options) {
|
|
|
60063
60086
|
`The GIF is still over GitHub's 5 MiB limit at ${fps} fps and ${width}px wide. Show less: a shorter --duration with --start at the interaction, or --crop to the area that changes.`
|
|
60064
60087
|
);
|
|
60065
60088
|
}
|
|
60066
|
-
var import_child_process4, import_fs8,
|
|
60089
|
+
var import_child_process4, import_fs8, import_path8, import_util9, GIF_MAX_BYTES, GIF_ATTEMPTS, execFileAsync;
|
|
60067
60090
|
var init_media_gif = __esm({
|
|
60068
60091
|
"src/commands/media-gif.ts"() {
|
|
60069
60092
|
"use strict";
|
|
60070
60093
|
import_child_process4 = require("child_process");
|
|
60071
60094
|
import_fs8 = __toESM(require("fs"));
|
|
60072
|
-
|
|
60095
|
+
import_path8 = __toESM(require("path"));
|
|
60073
60096
|
import_util9 = require("util");
|
|
60074
60097
|
init_output();
|
|
60075
60098
|
GIF_MAX_BYTES = 5 * 1024 * 1024;
|
|
@@ -60078,6 +60101,129 @@ var init_media_gif = __esm({
|
|
|
60078
60101
|
}
|
|
60079
60102
|
});
|
|
60080
60103
|
|
|
60104
|
+
// src/commands/artifact.ts
|
|
60105
|
+
async function uploadArtifact(filePath, displayName, immutable) {
|
|
60106
|
+
const { fileName, body: body2 } = readUploadFile(filePath);
|
|
60107
|
+
const form = new FormData();
|
|
60108
|
+
form.append("file", new Blob([body2]), fileName);
|
|
60109
|
+
form.append("display_name", displayName);
|
|
60110
|
+
form.append("mutability", immutable ? "immutable" : "mutable");
|
|
60111
|
+
const { artifact: artifact2 } = await agentFetch("/v1/artifacts", { method: "POST", body: form });
|
|
60112
|
+
return artifact2;
|
|
60113
|
+
}
|
|
60114
|
+
async function artifactUploadCommand(filePaths, options) {
|
|
60115
|
+
if (!isAgentMode()) throw new Error("Run this inside a Replicas workspace. Only workspaces can upload artifacts.");
|
|
60116
|
+
const names = requireNamePerFile(filePaths, options.name ?? []);
|
|
60117
|
+
const results = await Promise.allSettled(
|
|
60118
|
+
filePaths.map((filePath, i) => uploadArtifact(filePath, names[i], options.immutable ?? false))
|
|
60119
|
+
);
|
|
60120
|
+
const uploads = [];
|
|
60121
|
+
const failures = [];
|
|
60122
|
+
results.forEach((result, i) => {
|
|
60123
|
+
if (result.status === "fulfilled") {
|
|
60124
|
+
uploads.push({ file: filePaths[i], artifact: result.value });
|
|
60125
|
+
} else {
|
|
60126
|
+
const reason = result.reason instanceof Error ? result.reason.message : String(result.reason);
|
|
60127
|
+
failures.push(`${filePaths[i]}: ${reason}`);
|
|
60128
|
+
}
|
|
60129
|
+
});
|
|
60130
|
+
output2({ uploads }, () => {
|
|
60131
|
+
for (const { artifact: artifact2 } of uploads) {
|
|
60132
|
+
const size = formatBytes(artifact2.size_bytes);
|
|
60133
|
+
const visibility = artifact2.owner ? `Private to ${artifact2.owner.display_name} until shared.` : "This workspace has no owner, so it belongs to the organization: everyone in it can see, rename and delete it.";
|
|
60134
|
+
console.log(`Saved artifact "${artifact2.display_name}" (${artifact2.kind}, ${size}). ${visibility}`);
|
|
60135
|
+
console.log(`[${markdownLabel(artifact2.display_name)}](${getArtifactUrl(artifact2.id)})`);
|
|
60136
|
+
}
|
|
60137
|
+
});
|
|
60138
|
+
if (failures.length > 0) throw new Error(`${failures.length} artifact upload(s) failed \u2014 ${failures.join("; ")}`);
|
|
60139
|
+
}
|
|
60140
|
+
async function artifactListCommand(options) {
|
|
60141
|
+
const query = new URLSearchParams();
|
|
60142
|
+
if (options.all) query.set("mutability", "all");
|
|
60143
|
+
else if (options.immutable) query.set("mutability", "immutable");
|
|
60144
|
+
for (const owner of options.owner ?? []) query.append("owner", owner);
|
|
60145
|
+
for (const kind of options.kind ?? []) query.append("kind", kind);
|
|
60146
|
+
if (options.workspace) {
|
|
60147
|
+
const workspaceId = options.workspace === true ? readAgentConfig()?.workspace_id : options.workspace;
|
|
60148
|
+
if (!workspaceId) throw new Error("Pass --workspace <id>, or run inside a workspace to list its artifacts.");
|
|
60149
|
+
query.set("workspace_id", workspaceId);
|
|
60150
|
+
}
|
|
60151
|
+
if (options.limit) query.set("limit", options.limit);
|
|
60152
|
+
if (options.page) query.set("page", options.page);
|
|
60153
|
+
const response = await orgAuthenticatedFetch(`/v1/artifacts?${query}`);
|
|
60154
|
+
output2(response, ({ artifacts, total }) => {
|
|
60155
|
+
if (artifacts.length === 0) console.log("No artifacts.");
|
|
60156
|
+
for (const artifact2 of artifacts) {
|
|
60157
|
+
const owner = artifact2.owner?.email ?? "organization";
|
|
60158
|
+
const size = formatBytes(artifact2.size_bytes);
|
|
60159
|
+
const columns = [artifact2.id, artifact2.kind, artifact2.mutability, artifact2.display_name, owner, size, artifact2.updated_at];
|
|
60160
|
+
console.log(columns.join(" "));
|
|
60161
|
+
}
|
|
60162
|
+
if (total > artifacts.length) console.log(`Showing ${artifacts.length} of ${total}. Use --page for more.`);
|
|
60163
|
+
});
|
|
60164
|
+
}
|
|
60165
|
+
async function artifactUrlCommand(artifactId) {
|
|
60166
|
+
const path14 = `/v1/artifacts/${artifactId}/url?disposition=attachment`;
|
|
60167
|
+
const response = await orgAuthenticatedFetch(path14);
|
|
60168
|
+
output2(response, ({ url: url2 }) => console.log(url2));
|
|
60169
|
+
}
|
|
60170
|
+
async function artifactRenameCommand(artifactId, name) {
|
|
60171
|
+
const { artifact: artifact2 } = await orgAuthenticatedFetch(`/v1/artifacts/${artifactId}`, {
|
|
60172
|
+
method: "PATCH",
|
|
60173
|
+
body: { display_name: name }
|
|
60174
|
+
});
|
|
60175
|
+
output2({ artifact: artifact2 }, () => console.log(`Renamed artifact ${artifact2.id} to "${artifact2.display_name}".`));
|
|
60176
|
+
}
|
|
60177
|
+
async function artifactDeleteCommand(artifactId) {
|
|
60178
|
+
await orgAuthenticatedFetch(`/v1/artifacts/${artifactId}`, { method: "DELETE" });
|
|
60179
|
+
outputSuccess(`Deleted artifact ${artifactId}`);
|
|
60180
|
+
}
|
|
60181
|
+
async function resolveGrantPath(artifactId, grantee) {
|
|
60182
|
+
if (grantee.organization && grantee.user) throw new Error("Pass either --user <email> or --organization, not both.");
|
|
60183
|
+
if (grantee.organization) {
|
|
60184
|
+
return { path: `/v1/artifacts/${artifactId}/shares/organization`, granteeName: "the organization" };
|
|
60185
|
+
}
|
|
60186
|
+
const email3 = grantee.user;
|
|
60187
|
+
if (!email3) throw new Error("Pass --user <email> or --organization.");
|
|
60188
|
+
const userId = await findMemberUserId(email3);
|
|
60189
|
+
if (!userId) throw new Error(`No member of this organization has the email "${email3}".`);
|
|
60190
|
+
return { path: `/v1/artifacts/${artifactId}/shares/users/${userId}`, granteeName: email3 };
|
|
60191
|
+
}
|
|
60192
|
+
async function artifactShareCommand(artifactId, options) {
|
|
60193
|
+
const permission = ARTIFACT_PERMISSIONS.find((value) => value === (options.permission ?? "view"));
|
|
60194
|
+
if (!permission) {
|
|
60195
|
+
throw new Error(`Invalid permission '${options.permission}'. Must be one of: ${ARTIFACT_PERMISSIONS.join(", ")}`);
|
|
60196
|
+
}
|
|
60197
|
+
const { path: path14, granteeName } = await resolveGrantPath(artifactId, options);
|
|
60198
|
+
const { share: share2 } = await orgAuthenticatedFetch(path14, { method: "PUT", body: { permission } });
|
|
60199
|
+
output2({ share: share2 }, () => console.log(`Shared artifact ${artifactId} with ${granteeName} (${share2.permission}).`));
|
|
60200
|
+
}
|
|
60201
|
+
async function artifactUnshareCommand(artifactId, options) {
|
|
60202
|
+
const { path: path14, granteeName } = await resolveGrantPath(artifactId, options);
|
|
60203
|
+
await orgAuthenticatedFetch(path14, { method: "DELETE" });
|
|
60204
|
+
outputSuccess(`Artifact ${artifactId} is no longer shared with ${granteeName}.`);
|
|
60205
|
+
}
|
|
60206
|
+
async function artifactSharesCommand(artifactId) {
|
|
60207
|
+
const shares = await orgAuthenticatedFetch(`/v1/artifacts/${artifactId}/shares`);
|
|
60208
|
+
output2(shares, ({ organization, users }) => {
|
|
60209
|
+
console.log(`Organization: ${organization ? organization.permission : "not shared"}`);
|
|
60210
|
+
if (users.length === 0) console.log("No people.");
|
|
60211
|
+
for (const share2 of users) console.log(`${share2.user?.email} ${share2.permission}`);
|
|
60212
|
+
});
|
|
60213
|
+
}
|
|
60214
|
+
var init_artifact = __esm({
|
|
60215
|
+
"src/commands/artifact.ts"() {
|
|
60216
|
+
"use strict";
|
|
60217
|
+
init_src();
|
|
60218
|
+
init_agent_api();
|
|
60219
|
+
init_api2();
|
|
60220
|
+
init_command_utils();
|
|
60221
|
+
init_config();
|
|
60222
|
+
init_members();
|
|
60223
|
+
init_output();
|
|
60224
|
+
}
|
|
60225
|
+
});
|
|
60226
|
+
|
|
60081
60227
|
// src/commands/issue.ts
|
|
60082
60228
|
async function callIssueTool(name, args, schema, printHuman) {
|
|
60083
60229
|
if (!isAgentMode() && !getApiKey()) throw new Error("replicas issue needs an API key: run `replicas login --api-key`, or use it inside a workspace.");
|
|
@@ -60229,13 +60375,13 @@ var init_issue = __esm({
|
|
|
60229
60375
|
|
|
60230
60376
|
// src/lib/headless-chrome.ts
|
|
60231
60377
|
function findChrome() {
|
|
60232
|
-
const dirs = (process.env.PATH ?? "").split(
|
|
60233
|
-
return dirs.flatMap((dir) => CHROME_NAMES.map((name) =>
|
|
60378
|
+
const dirs = (process.env.PATH ?? "").split(import_path9.default.delimiter).filter(Boolean);
|
|
60379
|
+
return dirs.flatMap((dir) => CHROME_NAMES.map((name) => import_path9.default.join(dir, name))).find((file2) => import_fs9.default.existsSync(file2)) ?? null;
|
|
60234
60380
|
}
|
|
60235
60381
|
function launchChrome() {
|
|
60236
60382
|
const executable = findChrome();
|
|
60237
60383
|
if (!executable) throw new Error(`Chrome is not installed (looked for ${CHROME_NAMES.join(", ")} on PATH)`);
|
|
60238
|
-
const userDataDir = import_fs9.default.mkdtempSync(
|
|
60384
|
+
const userDataDir = import_fs9.default.mkdtempSync(import_path9.default.join(import_os4.default.tmpdir(), "replicas-chrome-"));
|
|
60239
60385
|
const child = (0, import_child_process5.spawn)(executable, [
|
|
60240
60386
|
"--headless=new",
|
|
60241
60387
|
"--remote-debugging-pipe",
|
|
@@ -60337,14 +60483,14 @@ function launchChrome() {
|
|
|
60337
60483
|
}
|
|
60338
60484
|
};
|
|
60339
60485
|
}
|
|
60340
|
-
var import_child_process5, import_fs9, import_os4,
|
|
60486
|
+
var import_child_process5, import_fs9, import_os4, import_path9, import_stream, CHROME_NAMES, COMMAND_TIMEOUT_MS, CLOSE_TIMEOUT_MS;
|
|
60341
60487
|
var init_headless_chrome = __esm({
|
|
60342
60488
|
"src/lib/headless-chrome.ts"() {
|
|
60343
60489
|
"use strict";
|
|
60344
60490
|
import_child_process5 = require("child_process");
|
|
60345
60491
|
import_fs9 = __toESM(require("fs"));
|
|
60346
60492
|
import_os4 = __toESM(require("os"));
|
|
60347
|
-
|
|
60493
|
+
import_path9 = __toESM(require("path"));
|
|
60348
60494
|
import_stream = require("stream");
|
|
60349
60495
|
init_src();
|
|
60350
60496
|
CHROME_NAMES = ["google-chrome", "google-chrome-stable", "chromium", "chromium-browser"];
|
|
@@ -60448,7 +60594,7 @@ async function inspect(html, source) {
|
|
|
60448
60594
|
await resize(width, clampVisualHeight(Math.min(MAX_SCREENSHOT_HEIGHT, await settledHeight(page))));
|
|
60449
60595
|
const { data } = await page.send("Page.captureScreenshot", { format: "png" });
|
|
60450
60596
|
import_fs10.default.mkdirSync(SCREENSHOT_DIR, { recursive: true });
|
|
60451
|
-
const file2 =
|
|
60597
|
+
const file2 = import_path10.default.join(SCREENSHOT_DIR, `${import_path10.default.basename(source, import_path10.default.extname(source))}-${appearance}-${width}.png`);
|
|
60452
60598
|
import_fs10.default.writeFileSync(file2, Buffer.from(data, "base64"));
|
|
60453
60599
|
return file2;
|
|
60454
60600
|
};
|
|
@@ -60489,7 +60635,7 @@ function warnings(inspection) {
|
|
|
60489
60635
|
];
|
|
60490
60636
|
}
|
|
60491
60637
|
async function visualizeCommand(file2, options) {
|
|
60492
|
-
const source =
|
|
60638
|
+
const source = import_path10.default.resolve(file2);
|
|
60493
60639
|
if (!import_fs10.default.statSync(source, { throwIfNoEntry: false })?.isFile()) throw new Error(`File not found: ${source}`);
|
|
60494
60640
|
const { html: inlined, missing } = inlineLocalImages(import_fs10.default.readFileSync(source, "utf8"));
|
|
60495
60641
|
const html = injectVisualBootstrap(inlined);
|
|
@@ -60542,13 +60688,13 @@ Next: publish with \`replicas visualize ${file2} --title "<short title>"\`.`);
|
|
|
60542
60688
|
console.log("\nNext: paste the  line on its own line where the visual belongs in your final reply. The user sees the visual itself, so don't introduce or restate it; add only what it doesn't say. The Forge link is for posting outside Replicas chat (PRs, Slack, Linear); leave it out of your chat reply.");
|
|
60543
60689
|
});
|
|
60544
60690
|
}
|
|
60545
|
-
var import_fs10, import_http3,
|
|
60691
|
+
var import_fs10, import_http3, import_path10, MIB, MAX_IMAGE_BYTES, MAX_PAGE_BYTES, LOAD_TIMEOUT_MS, MAX_SCREENSHOT_HEIGHT, SCREENSHOT_DIR, LOCAL_IMAGE, webAppUrl, VIEWPORT_DEPENDENT_FIX, consoleErrors;
|
|
60546
60692
|
var init_visualize = __esm({
|
|
60547
60693
|
"src/commands/visualize.ts"() {
|
|
60548
60694
|
"use strict";
|
|
60549
60695
|
import_fs10 = __toESM(require("fs"));
|
|
60550
60696
|
import_http3 = __toESM(require("http"));
|
|
60551
|
-
|
|
60697
|
+
import_path10 = __toESM(require("path"));
|
|
60552
60698
|
init_urls();
|
|
60553
60699
|
init_design_tokens();
|
|
60554
60700
|
init_src();
|
|
@@ -60674,16 +60820,16 @@ function computeExecCommand(kind) {
|
|
|
60674
60820
|
return async (command, options) => {
|
|
60675
60821
|
if (command.length === 0) throw new Error(`Pass a command after --, e.g. replicas ${kind} exec -- ${kind === "gpu" ? "nvidia-smi" : "xcodebuild -version"}`);
|
|
60676
60822
|
const sandboxId = await resolveSandboxId(kind, options);
|
|
60677
|
-
const
|
|
60823
|
+
const path14 = `${BASE}/${sandboxId}/exec`;
|
|
60678
60824
|
if (options.detach) {
|
|
60679
|
-
const { jobId } = await agentFetch(
|
|
60825
|
+
const { jobId } = await agentFetch(path14, execRequest(command.join(" "), options));
|
|
60680
60826
|
output2({ jobId, sandboxId }, () => {
|
|
60681
60827
|
console.log(`Started job ${import_chalk30.default.bold(jobId)} in ${sandboxId}`);
|
|
60682
60828
|
console.log(import_chalk30.default.gray(`Follow it with: replicas ${kind} logs ${jobId} -f`));
|
|
60683
60829
|
});
|
|
60684
60830
|
return;
|
|
60685
60831
|
}
|
|
60686
|
-
const exitCode = await streamOutput(await agentRequest(
|
|
60832
|
+
const exitCode = await streamOutput(await agentRequest(path14, execRequest(command.join(" "), options)));
|
|
60687
60833
|
process.exitCode = exitCode ?? 1;
|
|
60688
60834
|
if (isJsonMode()) output2({ sandboxId, exitCode }, () => {
|
|
60689
60835
|
});
|
|
@@ -60716,21 +60862,21 @@ function assertTransferSize(bytes, localPath) {
|
|
|
60716
60862
|
}
|
|
60717
60863
|
}
|
|
60718
60864
|
function archive(localPath) {
|
|
60719
|
-
const
|
|
60720
|
-
if (!(0, import_node_fs3.existsSync)(
|
|
60721
|
-
if (!(0, import_node_fs3.statSync)(
|
|
60722
|
-
assertTransferSize((0, import_node_fs3.statSync)(
|
|
60723
|
-
return (0, import_node_child_process2.spawn)("tar", ["-czf", "-", "-C", (0, import_node_path3.dirname)(
|
|
60865
|
+
const path14 = (0, import_node_path3.resolve)(localPath);
|
|
60866
|
+
if (!(0, import_node_fs3.existsSync)(path14)) throw new Error(`${path14} does not exist`);
|
|
60867
|
+
if (!(0, import_node_fs3.statSync)(path14).isDirectory()) {
|
|
60868
|
+
assertTransferSize((0, import_node_fs3.statSync)(path14).size, localPath);
|
|
60869
|
+
return (0, import_node_child_process2.spawn)("tar", ["-czf", "-", "-C", (0, import_node_path3.dirname)(path14), (0, import_node_path3.basename)(path14)], { stdio: ["ignore", "pipe", "pipe"] });
|
|
60724
60870
|
}
|
|
60725
|
-
const listed = (0, import_node_child_process2.spawnSync)("git", ["-C",
|
|
60871
|
+
const listed = (0, import_node_child_process2.spawnSync)("git", ["-C", path14, "ls-files", "-co", "--exclude-standard", "-z"], { maxBuffer: 256 * 1024 * 1024 });
|
|
60726
60872
|
if (listed.status !== 0) {
|
|
60727
|
-
const du = (0, import_node_child_process2.spawnSync)("du", ["-sk", "--exclude=.git", "--exclude=node_modules",
|
|
60873
|
+
const du = (0, import_node_child_process2.spawnSync)("du", ["-sk", "--exclude=.git", "--exclude=node_modules", path14]);
|
|
60728
60874
|
assertTransferSize(Number(du.stdout.toString().split(" ")[0]) * 1024, localPath);
|
|
60729
|
-
return (0, import_node_child_process2.spawn)("tar", ["-czf", "-", "-C",
|
|
60875
|
+
return (0, import_node_child_process2.spawn)("tar", ["-czf", "-", "-C", path14, "--exclude=.git", "--exclude=node_modules", "."], { stdio: ["ignore", "pipe", "pipe"] });
|
|
60730
60876
|
}
|
|
60731
|
-
const files = listed.stdout.toString().split("\0").filter((file2) => file2 && (0, import_node_fs3.existsSync)((0, import_node_path3.join)(
|
|
60732
|
-
assertTransferSize(files.reduce((total, file2) => total + (0, import_node_fs3.statSync)((0, import_node_path3.join)(
|
|
60733
|
-
const child = (0, import_node_child_process2.spawn)("tar", ["-czf", "-", "-C",
|
|
60877
|
+
const files = listed.stdout.toString().split("\0").filter((file2) => file2 && (0, import_node_fs3.existsSync)((0, import_node_path3.join)(path14, file2)));
|
|
60878
|
+
assertTransferSize(files.reduce((total, file2) => total + (0, import_node_fs3.statSync)((0, import_node_path3.join)(path14, file2)).size, 0), localPath);
|
|
60879
|
+
const child = (0, import_node_child_process2.spawn)("tar", ["-czf", "-", "-C", path14, "--null", "-T", "-"], { stdio: ["pipe", "pipe", "pipe"] });
|
|
60734
60880
|
child.stdin.end(files.map((file2) => `${file2}\0`).join(""));
|
|
60735
60881
|
return child;
|
|
60736
60882
|
}
|
|
@@ -61505,7 +61651,7 @@ var init_theme = __esm({
|
|
|
61505
61651
|
|
|
61506
61652
|
// src/commands/local-control.ts
|
|
61507
61653
|
async function connectedComputers() {
|
|
61508
|
-
const dir =
|
|
61654
|
+
const dir = import_path11.default.join(import_os5.default.homedir(), DEVICES_DIR);
|
|
61509
61655
|
if (!import_fs11.default.existsSync(dir)) return [];
|
|
61510
61656
|
const names = import_fs11.default.readdirSync(dir).flatMap((entry) => entry.startsWith(LOCAL_CONTROL_FILE_PREFIX) && entry.endsWith(".conf") ? [entry.slice(LOCAL_CONTROL_FILE_PREFIX.length, -".conf".length)] : []);
|
|
61511
61657
|
const answers = await Promise.all(names.map((name) => execFileAsync2("ssh", ["-o", "BatchMode=yes", "-o", "ConnectTimeout=10", name, "true"], { timeout: 2e4 }).then(() => true, () => false)));
|
|
@@ -61577,14 +61723,14 @@ async function localControlRequestCommand(options) {
|
|
|
61577
61723
|
`));
|
|
61578
61724
|
});
|
|
61579
61725
|
}
|
|
61580
|
-
var import_child_process6, import_fs11, import_os5,
|
|
61726
|
+
var import_child_process6, import_fs11, import_os5, import_path11, import_util10, import_chalk36, execFileAsync2;
|
|
61581
61727
|
var init_local_control = __esm({
|
|
61582
61728
|
"src/commands/local-control.ts"() {
|
|
61583
61729
|
"use strict";
|
|
61584
61730
|
import_child_process6 = require("child_process");
|
|
61585
61731
|
import_fs11 = __toESM(require("fs"));
|
|
61586
61732
|
import_os5 = __toESM(require("os"));
|
|
61587
|
-
|
|
61733
|
+
import_path11 = __toESM(require("path"));
|
|
61588
61734
|
import_util10 = require("util");
|
|
61589
61735
|
import_chalk36 = __toESM(require("chalk"));
|
|
61590
61736
|
init_src();
|
|
@@ -61636,13 +61782,13 @@ function oneOf(values, value, label) {
|
|
|
61636
61782
|
if (!match) throw new Error(`Unknown ${label} "${value}". Use one of: ${values.join(", ")}`);
|
|
61637
61783
|
return match;
|
|
61638
61784
|
}
|
|
61639
|
-
function maskBody(
|
|
61785
|
+
function maskBody(path14, body2) {
|
|
61640
61786
|
let masked = 0;
|
|
61641
61787
|
const mask = (value) => {
|
|
61642
61788
|
masked += stringsIn(value).reduce((count, text5) => count + countSecrets(text5), 0);
|
|
61643
61789
|
return maskSecretsDeep(value);
|
|
61644
61790
|
};
|
|
61645
|
-
const setup =
|
|
61791
|
+
const setup = path14 === "/app-setup" ? securityAppSetupSubmissionSchema.safeParse(body2) : null;
|
|
61646
61792
|
if (setup?.success) {
|
|
61647
61793
|
const { recipe } = setup.data;
|
|
61648
61794
|
const prepared = recipe && prepareSecurityAppRecipe(recipe);
|
|
@@ -61654,23 +61800,23 @@ function maskBody(path13, body2) {
|
|
|
61654
61800
|
};
|
|
61655
61801
|
}
|
|
61656
61802
|
if (setup) return { body: body2, masked };
|
|
61657
|
-
if (
|
|
61803
|
+
if (path14.endsWith("/proofs") && body2 && typeof body2 === "object" && "content" in body2) {
|
|
61658
61804
|
const { content, ...meta3 } = body2;
|
|
61659
61805
|
return { body: { ...mask(meta3), content }, masked };
|
|
61660
61806
|
}
|
|
61661
|
-
if (
|
|
61807
|
+
if (path14 === "/fix" && body2 && typeof body2 === "object" && "files" in body2) {
|
|
61662
61808
|
const { files, ...meta3 } = body2;
|
|
61663
61809
|
return { body: { ...mask(meta3), files }, masked };
|
|
61664
61810
|
}
|
|
61665
61811
|
return { body: mask(body2), masked };
|
|
61666
61812
|
}
|
|
61667
|
-
function request(
|
|
61813
|
+
function request(path14, init) {
|
|
61668
61814
|
ensureOrgApiAuthenticated();
|
|
61669
|
-
if (!init) return orgAuthenticatedFetch(`/v1/code-security/run${
|
|
61670
|
-
const { body: body2, masked } = maskBody(
|
|
61815
|
+
if (!init) return orgAuthenticatedFetch(`/v1/code-security/run${path14}`);
|
|
61816
|
+
const { body: body2, masked } = maskBody(path14, init.body);
|
|
61671
61817
|
if (masked > 0) process.stderr.write(`masked ${masked} secret-shaped value(s) before sending
|
|
61672
61818
|
`);
|
|
61673
|
-
return orgAuthenticatedFetch(`/v1/code-security/run${
|
|
61819
|
+
return orgAuthenticatedFetch(`/v1/code-security/run${path14}`, { ...init, body: body2 });
|
|
61674
61820
|
}
|
|
61675
61821
|
function printRun({ run: run2 }) {
|
|
61676
61822
|
const units = Object.values(run2.coverage);
|
|
@@ -61738,7 +61884,7 @@ async function runCheckout() {
|
|
|
61738
61884
|
const gitIn = (dir, args) => (0, import_child_process7.execFileSync)("git", ["-C", dir, ...args], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], maxBuffer: 256 * 1024 * 1024 });
|
|
61739
61885
|
const checkout = run2.commit_sha && checkoutWithCommit(SANDBOX_PATHS.WORKSPACES_DIR, run2.commit_sha);
|
|
61740
61886
|
if (!checkout) throw new Error(`No checkout under ${SANDBOX_PATHS.WORKSPACES_DIR} has the run's commit ${run2.commit_sha}.`);
|
|
61741
|
-
return { run: run2, dir: (0,
|
|
61887
|
+
return { run: run2, dir: (0, import_path12.basename)(checkout), git: (args) => gitIn(checkout, args) };
|
|
61742
61888
|
}
|
|
61743
61889
|
function trackedFiles(run2, git) {
|
|
61744
61890
|
const commit = run2.commit_sha ?? "HEAD";
|
|
@@ -61937,7 +62083,7 @@ function changedFiles(worktree, commitSha, known) {
|
|
|
61937
62083
|
const mode = status === "D" ? oldMode : newMode;
|
|
61938
62084
|
if (mode !== "100644" && mode !== "100755") throw new Error(`${file2} is a ${mode === "120000" ? "symlink" : `mode ${mode} entry`}; a fix can change only regular files`);
|
|
61939
62085
|
if (status === "D") return { path: file2, mode, content: null };
|
|
61940
|
-
const content = import_fs12.default.readFileSync((0,
|
|
62086
|
+
const content = import_fs12.default.readFileSync((0, import_path12.join)(worktree, file2));
|
|
61941
62087
|
if (content.includes(0)) throw new Error(`${file2} is binary; a fix can change only text files`);
|
|
61942
62088
|
const text5 = content.toString("utf8");
|
|
61943
62089
|
if (addsSecret(text5, status === "A" ? "" : git(["cat-file", "blob", `${commitSha}:${file2}`]), known)) refused.push(file2);
|
|
@@ -61986,13 +62132,13 @@ async function securityReviewCommand(options) {
|
|
|
61986
62132
|
` : "\n Recorded. No pull request was opened.\n");
|
|
61987
62133
|
});
|
|
61988
62134
|
}
|
|
61989
|
-
var import_child_process7, import_fs12,
|
|
62135
|
+
var import_child_process7, import_fs12, import_path12, import_chalk37, CHUNK_LINES, CHUNK_FILES, TRACE_BRIEF;
|
|
61990
62136
|
var init_security2 = __esm({
|
|
61991
62137
|
"src/commands/security.ts"() {
|
|
61992
62138
|
"use strict";
|
|
61993
62139
|
import_child_process7 = require("child_process");
|
|
61994
62140
|
import_fs12 = __toESM(require("fs"));
|
|
61995
|
-
|
|
62141
|
+
import_path12 = require("path");
|
|
61996
62142
|
import_chalk37 = __toESM(require("chalk"));
|
|
61997
62143
|
init_src();
|
|
61998
62144
|
init_security_checkout();
|
|
@@ -62038,11 +62184,11 @@ function registerEnvironmentHookCommands(parent, config3) {
|
|
|
62038
62184
|
}
|
|
62039
62185
|
hooks.command("repository-hooks <env>").description(`List per-repo ${config3.kind} hooks defined in replicas.json / replicas.yaml`).action(run(config3.repositoryHooks));
|
|
62040
62186
|
}
|
|
62041
|
-
var
|
|
62187
|
+
var import_config22, import_commander, collect, program, organizationOptionalCommands, interactiveCommands, billing, org, config2, chat, chatQueue, share, pr, canvas, credentials, automation, repos, plugins, skills, artifact, media, issue2, environment, envConfig, envVars, envFiles, envSkills, envMcps, parsePortOption, envDevices, envWarmPool, preview, authenticatedPreviewHelp;
|
|
62042
62188
|
var init_src2 = __esm({
|
|
62043
62189
|
"src/index.ts"() {
|
|
62044
62190
|
"use strict";
|
|
62045
|
-
|
|
62191
|
+
import_config22 = require("dotenv/config");
|
|
62046
62192
|
import_commander = require("commander");
|
|
62047
62193
|
init_login3();
|
|
62048
62194
|
init_logout();
|
|
@@ -62071,6 +62217,7 @@ var init_src2 = __esm({
|
|
|
62071
62217
|
init_preview();
|
|
62072
62218
|
init_media3();
|
|
62073
62219
|
init_media_gif();
|
|
62220
|
+
init_artifact();
|
|
62074
62221
|
init_issue();
|
|
62075
62222
|
init_visualize();
|
|
62076
62223
|
init_compute2();
|
|
@@ -62243,6 +62390,15 @@ var init_src2 = __esm({
|
|
|
62243
62390
|
skills.command("create <file>").description("Save a SKILL.md as an organization skill").requiredOption("--title <text>", 'Short title, e.g. "Always use Conventional Commits"').action(run(skillsCreateCommand));
|
|
62244
62391
|
skills.command("update <name-or-id>").description("Update an organization skill").option("--title <text>", "New title").option("-f, --file <file>", "New SKILL.md content").action(run(skillsUpdateCommand));
|
|
62245
62392
|
skills.command("delete <id>").description("Delete an organization skill").action(run(skillsDeleteCommand));
|
|
62393
|
+
artifact = program.command("artifact").description("Keep files a workspace made: deliverables people can find, open and share after the workspace is gone");
|
|
62394
|
+
artifact.command("upload <files...>").description("Upload one or more files as artifacts, concurrently. They belong to the person this workspace belongs to").option("-n, --name <name>", "Required name people see. Pass one --name per file, in order.", collect, []).option("--immutable", "A record that never changes, such as a screenshot (default: mutable)").action(run(artifactUploadCommand));
|
|
62395
|
+
artifact.command("list").description("List your artifacts and those shared with you (mutable only unless --immutable or --all)").option("--immutable", "Only immutable artifacts").option("--all", "Mutable and immutable artifacts").option("--owner <owner>", "me, others or organization (repeatable)", collect, []).option("-k, --kind <kind>", "Viewer kind such as markdown, html or image (repeatable)", collect, []).option("-w, --workspace [id]", "Everything a workspace made that you can open (this workspace if no id)").option("-l, --limit <n>", "Page size (default 50, max 200)").option("-p, --page <n>", "Page number (default 1)").action(run(artifactListCommand));
|
|
62396
|
+
artifact.command("url <artifactId>").description("Print a short-lived download URL for an artifact").action(run(artifactUrlCommand));
|
|
62397
|
+
artifact.command("rename <artifactId> <name>").description("Rename an artifact (needs edit access)").action(run(artifactRenameCommand));
|
|
62398
|
+
artifact.command("share <artifactId>").description("Share an artifact with a member or the whole organization (needs edit access)").option("-u, --user <email>", "Member to share with").option("--organization", "Share with everyone in the organization").option("--permission <permission>", "view or edit (default view)").action(run(artifactShareCommand));
|
|
62399
|
+
artifact.command("unshare <artifactId>").description("Stop sharing an artifact with a member or the organization (anyone can remove their own access)").option("-u, --user <email>", "Member to remove").option("--organization", "Stop sharing with the organization").action(run(artifactUnshareCommand));
|
|
62400
|
+
artifact.command("shares <artifactId>").description("List who an artifact is shared with").action(run(artifactSharesCommand));
|
|
62401
|
+
artifact.command("delete <artifactId>").description("Permanently delete an artifact (owner only; anyone in the organization for organization-owned ones)").action(run(artifactDeleteCommand));
|
|
62246
62402
|
media = program.command("media").description("Share workspace media and HTML pages");
|
|
62247
62403
|
media.command("list").description("List media uploaded by a workspace (this workspace by default inside one)").option("-w, --workspace <id>", "Workspace ID").option("-k, --kind <kind>", "Filter by kind: image, video, audio, or html").option("-l, --limit <n>", "Page size (default 50, max 200)").option("-p, --page <n>", "Page number (default 1)").action(run(mediaListCommand));
|
|
62248
62404
|
media.command("url <mediaId>").description("Print a short-lived download URL for media").action(run(mediaUrlCommand));
|
|
@@ -62430,6 +62586,7 @@ ${VISUAL_PAGE_RULES}`).action(run(visualizeCommand));
|
|
|
62430
62586
|
"preview",
|
|
62431
62587
|
"service",
|
|
62432
62588
|
"media",
|
|
62589
|
+
"artifact",
|
|
62433
62590
|
"issue",
|
|
62434
62591
|
"visualize",
|
|
62435
62592
|
"gpu",
|